Skip to content

Instantly share code, notes, and snippets.

@buger
Created October 21, 2009 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buger/215226 to your computer and use it in GitHub Desktop.
Save buger/215226 to your computer and use it in GitHub Desktop.
<?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/');
$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);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment