php - curl bot not working write -


i want write script parse time table of university , save disc. use curl, it. main link time table here, if open in browser can see content, if try open in curl have failure =(

here source code of php script:

<?       $url = "http://cist.kture.kharkov.ua/ias/app/tt/f?p=778:201:128623920522090:::201:p201_first_date,p201_last_date,p201_group,p201_potok:01.02.2012,30.07.2012,2423461,0:";      $ch = curl_init();       $cookiefile = tempnam ( dirname(__file__) . "/cookies/", 'cookie-' );        curl_setopt($ch, curlopt_cookiejar, $cookiefile );     curl_setopt($ch, curlopt_cookiefile, $cookiefile );      curl_setopt($ch, curlopt_returntransfer, true );      $ua = "mozilla/5.0 (x11; linux i686) applewebkit/535.11 (khtml, gecko) chrome/17.0.963.26 safari/535.11";       //$headers = array('host: cist.kture.kharkov.ua','connection: keep-alive','cache_control: max-age=0','user_agent: mozilla/5.0 (x11; linux i686) applewebkit/535.11 (khtml, gecko) chrome/17.0.963.26 safari/535.11','accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8','referer: http://google.com.ua',  'accept_encoding: gzip,deflate,sdch','accept_language: ru-ru,ru;q=0.8,en-us;q=0.6,en;q=0.4','accept_charset: windows-1251,utf-8;q=0.7,*;q=0.3');     //curl_setopt($ch, curlopt_autoreferer, 1);     //curl_setopt($ch, curlopt_followlocation, 1);      //curl_setopt($ch, curlopt_httpheader, $headers);     curl_setopt($ch, curlopt_useragent, $ua);      curl_setopt($ch, curlopt_url, $url);      $data = curl_exec($ch);     $info = curl_getinfo($ch);      $counter = 0;     while($info['redirect_url']!= "")     {         echo "url => ". $url."<br />\n";         echo "redirect => ". $info['redirect_url']."<br /><br />\n";          curl_setopt($ch, curlopt_referer, $url);         curl_setopt($ch, curlopt_url, $info['redirect_url']);         $url = $info['redirect_url'];         $data = curl_exec($ch);           $info = curl_getinfo($ch);          $counter++;          if($counter>100)             break;     }            foreach ($info $key => $value) {             echo $key . " -> ".$value."<br />\n";         }                $html = htmlspecialchars($data);     echo "<pre>$html</pre>";      echo $cont;?> 

in result have empty page :( please me.

the link provided has 302 redirect, won't schedule, have follow redirect in order it.

more specifically, @ "location" header, , use location.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -