My web site uses cURL to retrieve data (business & restaurant listings, maps, directions, etc.) from other online sources (Google, Bing, Yahoo and Yelp). Everything was working well until the last couple of weeks when requests using cURL to retrieve data from external sources have been hanging, no data returned, no error code, just hanging. The same code works on my local server and on a couple of other free hosts.
Here's an example of code that is no longer working:
It seems that the only web site I can access now is Google. Attempts to access all other web sites hang.
Here's an example of code that is no longer working:
Code:
<?php
function getURL ($url) {
if (($c = curl_init ($url)) === false)
echo "Curl_init error: ".curl_error ($c);
if (curl_setopt ($c, CURLOPT_RETURNTRANSFER, true) === false)
echo "Curl_setopt error: ".curl_error ($c);
if (($data = curl_exec ($c)) === false)
echo "Curl_exec error: ".curl_error ($c);
else
echo "$data";
}
// This hangs ...
getURL ("http:/www.bing.com");
// This hangs ...
getURL ("http://local.yahooapis.com/LocalSearchService/V3/localSearch?".
"appid=<my app id>".
"&query=starbucks&latitude=47.6062095&longitude=-122.3320708&output=xml");
// This hangs ...
getURL ("http://api.bing.net/xml.aspx?".
"AppId=<my app id>".
"&Version=2.2&Query=sushi&Latitude=47.60881&Longitude=-122.338804&Sources=phonebook");
// This hangs ...
getURL ("http://api.yelp.com/business_review_search?".
"ywsid=<my app id>".
"&term=sushi&lat=47.60881&long=-122.338804");
// This works ...
getURL ("http://www.google.com");
// This hangs ...
getURL ("http://www.mapquestapi.com/directions/v1/route?".
"key=<my app id>".
"&from=SEA&to=BFI&format=xml");
?>