file_get_contents 获取的内容有误
file_get_contents is getting the wrong content
我在 PHP
中使用 file_get_contents
函数从网站获取数据,它运行良好。但是对于这个URL:
它没有获取那里的实际内容。
<?php
echo file_get_contents('http://benalman.com/code/projects/php-simple-proxy/ba-simple-proxy.php?url=http%3A%2F%2Fwww.goolge.com%2F');
?>
是的,它 return 一样,但是你看不到它,因为它有很多 HTML 和 Javascript。
下面是阅读 JSON 内容的示例:
header("Content-Type: text/plain");
$json = file_get_contents('http://benalman.com/code/projects/php-simple-proxy/ba-simple-proxy.php?url=http%3A%2F%2Fwww.youtube.com%2F');
print_r(json_decode($json));
我在 PHP
中使用 file_get_contents
函数从网站获取数据,它运行良好。但是对于这个URL:
它没有获取那里的实际内容。
<?php
echo file_get_contents('http://benalman.com/code/projects/php-simple-proxy/ba-simple-proxy.php?url=http%3A%2F%2Fwww.goolge.com%2F');
?>
是的,它 return 一样,但是你看不到它,因为它有很多 HTML 和 Javascript。
下面是阅读 JSON 内容的示例:
header("Content-Type: text/plain");
$json = file_get_contents('http://benalman.com/code/projects/php-simple-proxy/ba-simple-proxy.php?url=http%3A%2F%2Fwww.youtube.com%2F');
print_r(json_decode($json));