note 82935 added to ref.curl

From: Date: Fri, 02 May 2008 18:20:23 +0000
Subject: note 82935 added to ref.curl
Groups: php.notes 
Request: Send a blank email to php-notes+get-139000@lists.php.net to get a copy of this message
In order to prevent curl sending messages to the server error log, you need to instruct curl to use a temporary file for output on stderr. <?php $gacookie="/askapache/tmp/curl-1.txt"; @touch($gacookie); @chmod($gacookie,0666); if($fp = tmpfile()){ $ch = curl_init("http://www.askapache.com/p.php"); curl_setopt ($ch, CURLOPT_STDERR, $fp); curl_setopt ($ch, CURLOPT_VERBOSE, 2); curl_setopt ($ch, CURLOPT_ENCODING, 0); curl_setopt ($ch, CURLOPT_USERAGENT, 'Mozilla/5.0'); curl_setopt ($ch, CURLOPT_HTTPHEADER, $FF); curl_setopt ($ch, CURLOPT_COOKIEFILE, $gacookie); curl_setopt ($ch, CURLOPT_COOKIEJAR, $gacookie); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_FAILONERROR, 1); curl_setopt ($ch, CURLOPT_HEADER, 1); curl_setopt ($ch, CURLINFO_HEADER_OUT, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 30); $r=curl_exec($ch);$ch_info=curl_getinfo($ch); if (curl_errno($ch)) return false; else curl_close($ch); header("Content-type: text/plain"); echo $r; sleep(2); $postdata='keywords='.$_GET['k']; $ch1 = curl_init("http://www.askapache.com/p.php"); curl_setopt ($ch1, CURLOPT_STDERR, $fp); curl_setopt ($ch1, CURLOPT_VERBOSE, 2); curl_setopt ($ch1, CURLOPT_ENCODING, 0); curl_setopt ($ch1, CURLOPT_USERAGENT, 'Mozilla/5.0'); curl_setopt ($ch1, CURLOPT_COOKIEJAR, $gacookie); curl_setopt ($ch1, CURLOPT_COOKIEFILE, $gacookie); curl_setopt ($ch1, CURLOPT_POSTFIELDS, $postdata); curl_setopt ($ch1, CURLOPT_POST, 1); curl_setopt ($ch1, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch1, CURLOPT_FAILONERROR, 1); curl_setopt ($ch1, CURLOPT_HEADER, 1); curl_setopt ($ch1, CURLINFO_HEADER_OUT, 1); curl_setopt ($ch1, CURLOPT_CONNECTTIMEOUT, 30); $r=curl_exec ($ch1);$ch1_info=curl_getinfo($ch1); if (curl_errno($ch1)) return false; else curl_close($ch1); header("Content-type: text/plain");print_r($ch1_info);echo $r;sleep(2); }fclose($fp); @unlink($gacookie); ?> See also: http://www.askapache.com/security/curl-google-post-feed.html ---- Server IP: 87.124.64.96 Probable Submitter: 24.172.164.205 ---- Manual Page -- http://www.php.net/manual/en/ref.curl.php Edit -- https://master.php.net/note/edit/82935 Del: integrated -- https://master.php.net/note/delete/82935/integrated Del: useless -- https://master.php.net/note/delete/82935/useless Del: bad code -- https://master.php.net/note/delete/82935/bad+code Del: spam -- https://master.php.net/note/delete/82935/spam Del: non-english -- https://master.php.net/note/delete/82935/non-english Del: in docs -- https://master.php.net/note/delete/82935/in+docs Del: other reasons-- https://master.php.net/note/delete/82935 Reject -- https://master.php.net/note/reject/82935 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#139000) next »