I have a webserver where i call an url and it returns the html contents through this code:
$query = http_build_query(array('year'=>$year));
$url ='http://www.lottologia.com/lotto/?do=past-draws-archive&tab=&' . $query . '&empty=&group_num_selector=selected&numbers_selector_mode=add&numbers_selected=#main';
$context = stream_context_create(array('http' => array('header' => 'User-Agent: CharlesUserAgent1.0')));
$response = file_get_html($url, false, $context);
$html = str_get_html($response);
It worked until a few days ago. Now the $response return null. I checked the file_get_html method (simple html dom), and the file_get_contents return false. So this is the problem.
- I checked php.ini and there aren't problems (fopen, etc.);
- I tried with www.example.com and it returns false.
- I already tried the curl but it doesn't works. I returns 301 moved permanently. I checked on the web the solution for it but every suggestions don't work.
If possible i want to keep using the file_get_contents/file_get_html.