我試圖從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