1

I made a script that was getting content from another site using Simple HTML DOM Parser. It looked like this

include_once('simple_html_dom.php');

$html = file_get_html('http://csgolounge.com/'.$tradeid);       

foreach($html->find('div[id=tradediv]') as $trade) {
    $when = $trade->find('.tradeheader')[0];
 }

I was probably looking for content too often (every 30 secs) , and now i get empty html back.

I tryed to change User agent like this

$context = stream_context_create();
stream_context_set_params($context, array('user_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6\r\n'));
$html = file_get_html('http://csgolounge.com/profile?id='.$steamid, 0, $context);

But am still getting back empty html.

6
  • You have probably gotten your script blocked by attentive admins at this remote site Commented Feb 12, 2016 at 15:39
  • @Jeff What can i do about it ? Commented Feb 12, 2016 at 17:42
  • Many websites have policies that declare you are not allowed to scrape their data. Perhaps you need to contact them about a partnership agreement? Commented Feb 12, 2016 at 17:47
  • Hm , I am pretty sure many people scrape their data , i just have to find a way. Now I have fetch html using cURL. Can i somehow save it and than process it using Simple HTML DOM Parser ? Commented Feb 12, 2016 at 18:29
  • Sure, just use str_get_html on the response Commented Feb 12, 2016 at 21:09

1 Answer 1

6

The problem was that my html file was too big . Simple html dom has defined max file size define('MAX_FILE_SIZE', 600000). I changed it to 900000 and now its working again.

Sign up to request clarification or add additional context in comments.

1 Comment

after messing with many things on google ended up with this answer great...saved a lot of time

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.