PHPackages                             geekality/php-cross-domain-proxy - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. geekality/php-cross-domain-proxy

ActiveLibrary[HTTP &amp; Networking](/categories/http)

geekality/php-cross-domain-proxy
================================

Simple self-contained PHP proxy for cross-origin ajax requests.

v2.2.0(2y ago)241.4k12GPL-3.0-or-laterPHPPHP &gt;=7

Since Jan 15Pushed 2y ago2 watchersCompare

[ Source](https://github.com/Svish/php-cross-domain-proxy)[ Packagist](https://packagist.org/packages/geekality/php-cross-domain-proxy)[ RSS](/packages/geekality-php-cross-domain-proxy/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (16)Used By (0)

PHP Cross-Origin Proxy
======================

[](#php-cross-origin-proxy)

[![Latest version](https://camo.githubusercontent.com/b5a4b486fe3931d07340619683f8c0dac4c50f85db18e47860790203090647c1/68747470733a2f2f706f7365722e707567782e6f72672f6765656b616c6974792f7068702d63726f73732d646f6d61696e2d70726f78792f76657273696f6e3f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/geekality/php-cross-domain-proxy)[![Downloads](https://camo.githubusercontent.com/ce8defb9dac0fe43cc4232cf499d485157d9e37c1afec9d8ecd3b61c7c0d40d7/68747470733a2f2f706f7365722e707567782e6f72672f6765656b616c6974792f7068702d63726f73732d646f6d61696e2d70726f78792f646f776e6c6f6164733f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/geekality/php-cross-domain-proxy)[![License](https://camo.githubusercontent.com/892a8ad64a1d7c89047df770a9e7e1828a8a9323ab3210936b061ea863d9e1f0/68747470733a2f2f706f7365722e707567782e6f72672f6765656b616c6974792f7068702d63726f73732d646f6d61696e2d70726f78792f6c6963656e73653f666f726d61743d666c61742d737175617265)](LICENSE.txt)

Client-side HTTP requests, are limited by browser cross-origin restrictions.

Preferably fixed by [enabling CORS](http://enable-cors.org/server.html) on the server you're trying to call, but sometimes this just isn't possible because reasons.

A simple workaround is having a server-side proxy script on the same domain as your client-side script (e.g. both at `api.example.com`), and let the server do these cross-domain requests on behalf of the client.

This is such a script.

Installation
------------

[](#installation)

Since `proxy.php` is completely self-contained, you can just

1. Copy `proxy.php` into your web application,
2. Define the `$whitelist` array,
3. And that's pretty much it...

If using [Composer](http://getcomposer.org), you can also add the [geekality/php-cross-domain-proxy](https://packagist.org/packages/geekality/php-cross-domain-proxy) to your `composer.json` like this:

```
"require":
{
	"geekality/php-cross-domain-proxy": "1.*"
},
```

And then for example add a `proxy.php` like this to your web application:

```
