public
Last active

  • Download Gist
gistfile1.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
<?php
// PHP Proxy example for Yahoo! Web services.
// Responds to both HTTP GET and POST requests
//
// Author: Jason Levitt
// December 7th, 2005
//
 
// Allowed hostname (api.local and api.travel are also possible here)
define ('HOSTNAME', 'http://pipes.yahoo.com/pipes/pipe.run');
 
$url = HOSTNAME.$path;
 
// Open the Curl session
$session = curl_init($url);
 
// Don't return HTTP headers. Do return the contents of the call
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
 
// Make the call
$json = curl_exec($session);
 
// The web service returns XML. Set the Content-Type appropriately
header("Content-Type: application/json; charset=utf-8");
 
echo $json;
curl_close($session);
 
?>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.