document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. // Allow from any origin
  2. if (isset($_SERVER[\'HTTP_ORIGIN\'])) {
  3.     // should do a check here to match $_SERVER[\'HTTP_ORIGIN\'] to a
  4.     // whitelist of safe domains
  5.     header("Access-Control-Allow-Origin: {$_SERVER[\'HTTP_ORIGIN\']}");
  6.     header(\'Access-Control-Allow-Credentials: true\');
  7.     header(\'Access-Control-Max-Age: 86400\');    // cache for 1 day
  8. }
  9. // Access-Control headers are received during OPTIONS requests
  10. if ($_SERVER[\'REQUEST_METHOD\'] == \'OPTIONS\') {
  11.  
  12.     if (isset($_SERVER[\'HTTP_ACCESS_CONTROL_REQUEST_METHOD\']))
  13.         header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS");        
  14.  
  15.     if (isset($_SERVER[\'HTTP_ACCESS_CONTROL_REQUEST_HEADERS\']))
  16.         header("Access-Control-Allow-Headers: {$_SERVER[\'HTTP_ACCESS_CONTROL_REQUEST_HEADERS\']}");
  17.  
  18. }
');