Using Chrome to inspect the url: http://www.wizards.com/Magic/PlaneswalkerPoints/76954206# I am able to see the url where the JSON data is grabbed from:
Request URL:http://www.wizards.com/Magic/PlaneswalkerPoints/JavaScript/GetPointsSummary/76954206
Running my code:
$user_agent = 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36';
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_FAILONERROR, 1); // Fail on errors
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects
curl_setopt($ch, CURLOPT_TIMEOUT, 5); // times out after 5s
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Content-Length: ' . strlen($json)));
curl_setopt($ch, CURLOPT_POST, 1);
// receive server response ...
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec ($ch);
curl_close ($ch);
// further processing ....
if ($server_output == "OK") {
print_r($ch);
} else {
echo "Boo";
}
Leaves me with a blank page. It's not returning JSON, only the redirect error page.
Is there a certain call I am missing to grab the JSON data?