0

I tried first example from http://php.net/manual/en/function.file-get-contents.php

<?php
   $homepage = file_get_contents('http://www.scibet.com/');
   echo $homepage;
?>

I only get this:

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

Where is the problem?

Paresh Gami
  • 4,777
  • 5
  • 23
  • 41
user3590094
  • 119
  • 1
  • 2
  • 11
  • what are you trying to read the entire site? – Fakhruddin Ujjainwala Feb 27 '16 at 13:02
  • Yes, i need way to get all content from external url... – user3590094 Feb 27 '16 at 13:05
  • Try stream_get_contents instead // only works if fopen is allowed on the site's server and in PHP5+ $handle = fopen("http://websiteyouwanttoscrape.com/file.html", "r"); $contents = stream_get_contents($handle); An example on http://stackoverflow.com/questions/34834038/php-find-and-get-value-based-on-another-one-from-html-table-parsed-file/34835046#34835046 – Steve Feb 27 '16 at 21:19

1 Answers1

0

Your setup may have allow_url_fopen not set up. You need to set up a configuration directive in order to be able to open files via HTTP, because by default file_get_contents() only works for local files.

See here for more explanations on how to do it: http://php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen

Paweł Pela
  • 421
  • 3
  • 16