Advertisement
Guest User

Patch for simpleHtmlDomBakedComponent->curl_and_load()

a guest
Feb 10th, 2011
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.49 KB | None | 0 0
  1. function curl_and_load($url, $lowercase=true, $curlopts=false){
  2.         $ch = curl_init($url);
  3.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  4.         $useragent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)";
  5.         curl_setopt($ch, CURLOPT_USERAGENT, $useragent);       
  6.         if($curlopts)
  7.         {
  8.             foreach($curlopts as $o => $s)
  9.             {
  10.                 curl_setopt($ch, $o, $s);
  11.             }  
  12.         }
  13.         $curl_scraped_page = curl_exec($ch);
  14.         curl_close($ch);
  15.         $this->load($curl_scraped_page,$lowercase);
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement