您可以使用 curl 来避免显示 php 错误:
$externalUrl = ** your http request **
curl_setopt($curl, CURLOPT_URL, $externalUrl); // Set the URL
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36'); // Use your user agent
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // Set so curl_exec returns the result instead of outputting it.
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // Bypass SSL Verifyers
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/x-www-form-urlencoded'
));
$result = curl_exec($curl); // send request
$result = json_decode($result);