4

I am looking for some advice on the best way to retrieve information from a web page (my own site) and then search through that information to find a certain text.

Keeping in mind that some of the servers that run PHP/Joomla do not have cURL enabled, I don't want to cause any unexpected errors.

I've looked at both fopen() and file_get_contents() and both seem to have conflicting views of each other in terms of which will work with/without cURL.

James Jones
  • 3,850
  • 5
  • 25
  • 44
privateace
  • 1,367
  • 6
  • 16
  • 24

1 Answers1

4

They will both work without curl, but you need to have allow_url_fopen enabled. You can check that by executing phpinfo(). There are security implications however, see this:

Should I allow 'allow_url_fopen' in PHP?

So to grab pages, you can use fopen(), file_get_contents() or some other independent HTTP client implemented in PHP such as HttpClient that can function without those.

Community
  • 1
  • 1
karim79
  • 339,989
  • 67
  • 413
  • 406