cors-anywhere
is a php reverse proxy which adds CORS headers to the proxy request.
It can be used to access resources from third party websites when it's not possible to enable CORS on target website i.e. when you don't own that website.
Note from author: I am currently using to access Rescue Time's & trak.tv APIs, so I can sync my own data to conjure.so.
composer require fakeheal/cors-anywhere
<?php
use Fakeheal\CorsAnywhere\Exceptions\CorsAnywhereException;
use Fakeheal\CorsAnywhere\Proxy;
// ...
try {
$server = new Proxy([
// allowed hosts to proxy to
'rescuetime.com',
'google.com'
], [
// allowed headers
'Content-Type',
'Accepts'
]);
// call handle that... handles everything
$server->handle();
} catch (CorsAnywhereException $e) {
die($e->getMessage()); // or die trying
}
To run tests, run the following command
./vendor/bin/pest
This project is used by the following entities: