Advertisement
asanchez75

proxy/php/cors

Aug 9th, 2016
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. <?php
  2. // http://stackoverflow.com/questions/2491439/problems-reading-rss-feed-with-jquery-get
  3. // $session = curl_init($_GET['url']);
  4. // curl_setopt($session, CURLOPT_HEADER, false);
  5. // curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
  6. // $xml = curl_exec($session);
  7. // header("Content-Type: text/xml");
  8. // echo $xml;
  9. // curl_close($session);
  10.  
  11. $session = curl_init($_GET['url']);
  12. curl_setopt($session, CURLOPT_HEADER, false);
  13. curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
  14. $xml = curl_exec($session);
  15. header("Access-Control-Allow-Origin: *");
  16. header("Content-Type: application/json");
  17. echo $xml;
  18. curl_close($session);
  19. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement