clankill3r Posted October 26, 2011 Share Posted October 26, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/249865-get-all-words-from-a-page/ Share on other sites More sharing options...
requinix Posted October 26, 2011 Share Posted October 26, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/249865-get-all-words-from-a-page/#findComment-1282508 Share on other sites More sharing options...
clankill3r Posted October 27, 2011 Author Share Posted October 27, 2011 I just switched hosting cause the prevrious one sucked... I wrote a ticket now, hope they can help so i don't have to write the 3xx handler... Quote Link to comment https://forums.phpfreaks.com/topic/249865-get-all-words-from-a-page/#findComment-1282814 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.