I want to capture the response of a site (http://gnocchi-www.buffalo-ggn.net/bingo2-v2.47.0-JACKET/js/cache/static_desktop_data.json) in my php file to write the available collection items in a databse.
If I enter the adress in my browser, I get a json string as response. But If I use a cURL request, I get an empty response.
Here is my curl code:
$url = 'http://gnocchi-www.buffalo-ggn.net/bingo2-v2.47.0-JACKET/js/cache/static_desktop_data.json';
$headers = array(
"Content-Type: application/x-www-form-urlencoded",
"Host: gnocchi-www.buffalo-ggn.net",
"Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4",
"Accept-Encoding: gzip,deflate,sdch",
"Accept: */*"
);
$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_GET, true);
curl_setopt( $ch, CURLOPT_HEADER, true);
curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt( $ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36");
curl_setopt( $ch, CURLOPT_REFERER, "https://gs1.wac.edgecastcdn.net/805F48/gnocchi/bingo2-v2.47.0-JACKET/assets/Game.swf");
curl_setopt( $ch, CURLOPT_VERBOSE, true);
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true);
$response=curl_exec( $ch );
echo $response;
the headers that are sent when I enter the url in browser are:
Host: gnocchi-www.buffalo-ggn.net
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36
Accept-Encoding: gzip,deflate,sdch
Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
Can anyone help me with this problem ???
Content-Lengthheader). You get a few warnings for your code though - try turning onerror_reporting(E_ALL);to see if you get some useful info out of it.CURLOPT_GEToption doesn't exists (php.net/manual/en/function.curl-setopt.php)