Return to Snippet

Revision: 67074
at August 6, 2014 20:58 by dmkim


Initial Code
$ch = curl_init();
          curl_setopt($ch, CURLOPT_HEADER,0);
          curl_setopt($ch, CURLOPT_URL, $url);
          curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
          curl_setopt($ch, CURLOPT_TIMEOUT,10);
          curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
          curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0");
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         
          if (isset($_COOKIE[session_name()]))
             curl_setopt($ch, CURLOPT_COOKIE, session_name().'='.$_COOKIE[session_name()].'; path=/');
         
          session_write_close();
          $result = curl_exec($ch);
                 
          if (curl_errno($ch)) {
 
                echo 'curl error: '.curl_error($ch);   
          }
          
          curl_close($ch);
          session_start();

Initial URL

                                

Initial Description
Request page via curl with current session cookie

Initial Title
Request page via curl with current session cookie

Initial Tags

                                

Initial Language
PHP