Home > Malo mešano > cURL

cURL

PHP:
  1. function disguise_curl($postaja, $proga)
  2. {
  3.   $curl = curl_init();
  4.  
  5.   // Setup headers - I used the same headers from Firefox version 2.0.0.6
  6.   // below was split up because php.net said the line was too long. :/
  7.   $header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";
  8.   $header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
  9.   $header[] = "Cache-Control: max-age=0";
  10.   $header[] = "Connection: keep-alive";
  11.   $header[] = "Keep-Alive: 300";
  12.   $header[] = "Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7";
  13.   $header[] = "Accept-Language: sl, en-us,en;q=0.5";
  14.   $header[] = "Pragma: "; // browsers keep this blank.
  15.  
  16.   curl_setopt($curl, CURLOPT_URL, 'http://bus.talktrack.com/Default.aspx');
  17.   curl_setopt($curl, CURLOPT_USERAGENT, 'Googlebot/2.1 (+http://www.google.com/bot.html)');
  18.   curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
  19.   curl_setopt($curl, CURLOPT_REFERER, 'http://www.google.com');
  20.   curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
  21.   curl_setopt($curl, CURLOPT_AUTOREFERER, true);
  22.   curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  23.   curl_setopt($curl, CURLOPT_TIMEOUT, 10);
  24.     curl_setopt($curl, CURLOPT_POST, true);
  25.     curl_setopt($curl, CURLOPT_POSTFIELDS,'__VIEWSTATE=%2FwEPDwUKLTgzNjU3NTU0NmRkyqriZHRludwvoChm7gDsbpNBymw%3D&tb_stationNo='.$postaja.'&tb_routeNo='.$proga.'&b_submit=Prika%C5%BEi');
  26.  
  27.   $html = curl_exec($curl); // execute the curl command
  28.   curl_close($curl); // close the connection
  29.  
  30.   return $html; // and finally, return $html
  31. }

Categories: Malo mešano Tags:
  1. September 14th, 2011 at 19:45 | #1

    You ought to really take into consideration working on developing this weblog into a serious authority on this market. You evidently have a grasp deal with of the topics everyone seems to be trying to find on this web site in any case and you would certainly even earn a buck or two off of some advertisements. I might explore following latest topics and elevating the quantity of write ups you set up and I assure you’d start seeing some wonderful focused visitors in the close to future. Only a thought, good luck in no matter you do!

  1. No trackbacks yet.

0 pages viewed, 0 today
0 visits, 0 today
FireStats icon Powered by FireStats