Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Aug 11th, 2013  |  syntax: None  |  size: 1.35 KB  |  views: 27  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
  2.        
  3. //make a call the the webpage to get his handicap
  4. $ch = curl_init();
  5. curl_setopt($ch, CURLOPT_URL, "http://www.golfspain.com/portalgolf/HCP/handicap_resul.aspx?sLic=CB00693474");
  6. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
  7. curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE );
  8. curl_setopt($ch, CURLOPT_REFERER, "http://google.com" );
  9. curl_setopt($ch, CURLOPT_HEADER, TRUE );
  10. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
  11. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13');
  12. $header = array(
  13.     'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  14.     'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7',
  15.     'Accept-Language: en-us;q=0.8,en;q=0.6'
  16. );
  17. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  18. $html = curl_exec($ch);
  19. curl_close($ch);
  20.  
  21. $doc = new DOMDocument();
  22. $doc->strictErrorChecking = FALSE;
  23. $doc->loadHTML($html);
  24. $xml = simplexml_import_dom($doc);
  25.        
  26. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13');
  27. $header = array(
  28.     'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  29.     'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7',
  30.     'Accept-Language: en-us;q=0.8,en;q=0.6'
  31. );
  32. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
clone this paste RAW Paste Data