我试图从http://php.net/manual/en/function.file-get-contents.phpPHP的file_get_contents()函数
<?php
$homepage = file_get_contents('http://www.scibet.com/');
echo $homepage;
?>
第一个例子,我只得到这样的:
Notice: file_get_contents(): send of 16 bytes failed with errno=10053 An established connection was aborted by the software in your host machine. in C:\xampp\htdocs\scraper\test.php on line 2
Notice: file_get_contents(): send of 22 bytes failed with errno=10053 An established connection was aborted by the software in your host machine. in C:\xampp\htdocs\scraper\test.php on line 2
Notice: file_get_contents(): send of 19 bytes failed with errno=10053 An established connection was aborted by the software in your host machine. in C:\xampp\htdocs\scraper\test.php on line 2
Notice: file_get_contents(): send of 2 bytes failed with errno=10053 An established connection was aborted by the software in your host machine. in C:\xampp\htdocs\scraper\test.php on line 2
Warning: file_get_contents(http://www.scibet.com/): failed to open stream: HTTP request failed! in C:\xampp\htdocs\scraper\test.php on line 2
问题出在哪里?
什么是你想阅读整个网站? –
是的,我需要的方式来获取来自外部网址的所有内容... – user3590094
尝试stream_get_contents而不是//只在网站的服务器和PHP5中允许fopen + $ handle = fopen(“http://websiteyouwanttoscrape.com/ file.html“,”r“); $ contents = stream_get_contents($ handle);一个例子,在http://stackoverflow.com/questions/34834038/php-find-and-get-value-based-on-another-one-from-html-table-parsed-file/34835046#34835046 – Steve