2
我想获得一个代码脚本的工作,但我得到
未定义的变量:http_response_header
错误。我搜索了一下,发现$ http_response_header是全局的,并且内置到php中,为什么我会得到这个错误。我正在使用安装PHP 5.4的wamp。这里是我的代码:
$url="https://data.mtgox.com/api/2/BTCCAD/money/ticker";
$json = @file_get_contents($url);
//check for errors
if (strpos($http_response_header[0], "200")) {
// On success, decode JSON
$data = json_decode($json);
感谢 艾哈迈尔
你在哪里读了'$ http_response_header'是全球性的? – Fractaliste
该文档明确指出'$ http_response_header'不是全局的。 http://www.php.net/manual/en/reserved.variables.httpresponseheader.php我建议反正使用cURL。 – Brad
@Brad我正试图让这个股票工作。但是它使用http标题响应http://skybin.net/bitcoin-ticker-on-your-website/ –