Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. $url = "http://rfaf.es/pnfg/NPcd/NFG_CmpJornada?cod_primaria=1000120&CodCompeticion=2063709&CodGrupo=2063742&CodTemporada=10&CodJornada=7&Sch_Codigo_Delegacion=&Sch_Tipo_Juego=";
  2.  
  3. print_r(get_web_page($url));
  4.  
  5. function get_web_page( $url )
  6. {
  7. $ckfile = tempnam ("/tmp", "CURLCOOKIE");
  8.  
  9. $options = array(
  10. CURLOPT_RETURNTRANSFER => true, // return web page
  11. CURLOPT_HEADER => true, // don't return headers
  12. CURLOPT_FOLLOWLOCATION => true, // follow redirects
  13. CURLOPT_ENCODING => "", // handle compressed
  14. CURLOPT_USERAGENT => "spider", // who am i
  15. CURLOPT_AUTOREFERER => true, // set referer on redirect
  16. CURLOPT_CONNECTTIMEOUT => 1200, // timeout on connect
  17. CURLOPT_TIMEOUT => 1200, // timeout on response
  18. CURLOPT_MAXREDIRS => 100, // stop after 10 redirects
  19. CURLOPT_COOKIESESSION => true,
  20. CURLOPT_COOKIEJAR => $ckfile,
  21. CURLOPT_COOKIEFILE => $ckfile,
  22.  
  23. );
  24.  
  25. $ch = curl_init( $url );
  26. curl_setopt_array( $ch, $options );
  27. $content = curl_exec( $ch );
  28. $err = curl_errno( $ch );
  29. $errmsg = curl_error( $ch );
  30. $header = curl_getinfo( $ch );
  31. curl_close( $ch );
  32.  
  33. $header['errno'] = $err;
  34. $header['errmsg'] = $errmsg;
  35. $header['content'] = $content;
  36. return $header;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement