我的代码:的游离碱MQL阅读服务和PHP的file_get_contents
$api_url = "https://www.googleapis.com/freebase/v1-sandbox/mqlread?query=";
$query = $freebase_query."&callback=myfuncname"."&key=".$cfg['fbkey'];
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: en\r\n" .
"Cookie: foo=bar\r\n"
)
);
$context = stream_context_create($opts);
$json = file_get_contents($api_url.$query, false, $context, null);
$display = $api_url.$query;
$json_output = json_decode($json);
错误: 警告:的file_get_contents(https://www.googleapis.com/freebase/v1-sandbox/mqlread?query= [ {"中间":空,"名称":空,"主题:中间| = ":[" /米/ 0gn30 "," /米/ 0tc7 "]}] &回调= myfuncname &键= [键])[功能.file-get-contents]:无法打开流:HTTP请求失败! HTTP/1.0 [文件名] 400错误的请求 上线
如果我直接将URL粘贴到浏览器中我得到的返回结果没有任何问题!所以我认为它是我打电话给服务的方式?
看到这个线程:http://stackoverflow.com/questions/3535799/file-get-contents-failed-to-open-stream,HTTP: //stackoverflow.com/questions/1975461/file-get-contents-with-https –