Hi i have a domain i'd like to parse with cUrl and here is the case:
When i go on domain http://register.metsad.ee/avalik/info_teatis.php?too_id=2942704201
it redirects me to [ register.metsad.ee/avalik/info_teatis.php?too_id=2942704201 ]
its the same thing without http:// www. code i use to parse is:
function get_data($url) {
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$src = 'http://register.metsad.ee/avalik/info_teatis.php?too_id=2942704201';
And then $c = get_data($src);
echo $c;
For resoult i get a blank white page. I also tried with Simple_Html_Dom parser like this:
echo file_get_html($src)->plaintext;
But still i get a blank white page. When i trie to parse without http:// then there is an error that
Warning: file_get_contents(register.metsad.ee/avalik/info_teatis.php?too_id=2942704201) [function.file-get-contents]: failed to open stream: Result too large in C:\xampp\htdocs\Trash\metsakontroll\system\c_simple_html_dom.php on line 70
cUrl gives still white screen, no effect. When i tried to parse it like a folder like this:
http://www.metsad.ee/register/avalik/info_teatis.php?too_id=2942704201 then server says Not Found
i searched the whole internet =/ any ideas how to read that page via cUrl or Simple_html_dom ?