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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.