Hi all!
I tried to scrape the tickerdata from Mt Gox, but it doesn't work.
I tested it several ways, but nothing works. When I open the API-adress in the browser, I get a download with getDepth.php or Ticker.php in which the data is included, but there is no way to scrape it.
I saw somebody writing here, that Mt.Gox needs to be accessed with an Useragent set, but even that changes nothing.
Can someone help me please, and tell me, what I'm doing wrong?
Here is a php snippet which works for all other sites out there but not for Mt Gox
function get_data($url)
{
$useragent="Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0";
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$site="https://mtgox.com/code/data/getDepth.php";
$data=get_data($site);
echo $data;
Thanks