Jump to content

get all words from a page


clankill3r

Recommended Posts

I would like to get all words from a site in a array.

I found this great thing:

http://simplehtmldom.sourceforge.net/

 

however it makes use of:

file_get_contents

 

which gives me:

Warning: file_get_contents() [function.file-get-contents]: http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in

 

And my hosting doesn't allow a change for that, they tell me to use curl.

 

With curl i get this:

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in

 

It's caused by this line:

curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1);

 

But setting it to 0 cause then instead of getting the word from the page i want i get the following words in a array:

302 Moved The Document has moved here

 

What can i do now?

Link to comment
https://forums.phpfreaks.com/topic/249865-get-all-words-from-a-page/
Share on other sites

Complain to your hosting provider that their PHP support sucks.

 

You basically have to write your own 3xx handler. Inside a loop, retrieve the URL and its headers. If you get a 3xx status code (like 302) then look for a Location: header and use that URL for the next loop iteration. Keep going until you get something that isn't a 3xx.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.