Php 如何从youtube v3读取响应错误

Php 如何从youtube v3读取响应错误,php,youtube-data-api,Php,Youtube Data Api,我打电话获取我的回复和信息,然后打印出来查看一切正常 $data = file_get_contents( [CALL TO API] ); $data = json_decode($data, true); print("<pre>".print_r($data,true)."</pre>"); 但我只得到了一张厚纸板页。 所以我决定用我的回传头球 array(1) { [0]=> string(23) "X-Powered-By: PHP/5.4.7" }

我打电话获取我的回复和信息,然后打印出来查看一切正常

$data = file_get_contents( [CALL TO API]  );
$data = json_decode($data, true);
print("<pre>".print_r($data,true)."</pre>");
但我只得到了一张厚纸板页。
所以我决定用我的回传头球

array(1) { [0]=> string(23) "X-Powered-By: PHP/5.4.7" }
int(200)
这给了我

$data = file_get_contents([CALL TO API]);
print_r($data); // Will print the response HTTP body
print_r($http_response_header); // Will print the response HTTP headers
正如你所看到的,它给了我一个“200”OK的标题,但没有太多其他的。 那么我如何才能看到youtube演示页面显示的内容呢?

这也将有助于以后在我的站点完成时进行错误检查。

感谢您的快速回复。“$http\u response\u header”给了我--Array([0]=>http/1.0 403禁止[1]=>Vary:X-Origin[2]=>Content-Type:application/json;charset=UTF-8[3]=>Date:Sun,2017年3月5日16:18:25 GMT[4]=>Expires:Sun,2017年3月5日16:18:25 GMT[5]=>Cache-Control:private,max-age=0[6]=>X-Content-Type-Options:nosniff[7]=>X-Frame-Options:SAMEORIGIN[8]=>X-XSS-Protection:1;mode=block[9]=>Server:GSE[10]=>Alt-Svc:quic=“:443;ma=2592000;v=“36,35,34”[11]=>接受范围:无[12]=>Vary:Origin,接受编码)但仍然没有YouTube信息重新调谐,出于某种原因,您显然获得了403禁止状态。请查看youtube v3文档以了解原因。祝你好运。我知道403代码的原因。我的问题是无法获得错误的api响应。我想要api的可打印响应。但是谢谢你帮助我更好地阅读标题。P.S.print_r($data)仍然没有像以前那样做任何事情。
array(1) { [0]=> string(23) "X-Powered-By: PHP/5.4.7" }
int(200)
$data = file_get_contents([CALL TO API]);
print_r($data); // Will print the response HTTP body
print_r($http_response_header); // Will print the response HTTP headers