views:

420

answers:

1

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.

Any advice?

+4  A: 

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:

http://stackoverflow.com/questions/127534/should-i-allow-allowurlfopen-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.

karim79