note 104369 added to function.curl-setopt-array

From: Date: Sat, 11 Jun 2011 14:59:53 +0000
Subject: note 104369 added to function.curl-setopt-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-180438@lists.php.net to get a copy of this message
it should be noted that when using CURLOPT_POSTFIELDS in a loop, CURLOPT_POSTFIELDS appends to the sting. You can use unset() if you don't want this sort of behavior. <?php //this will append postfields while(true) { $options = array(CURLOPT_POSTFIELDS => 'foo=bar&foo2=bar'); $ch = curl_init("http://www.example.com"); curl_setopt_array($ch, $options); curl_exec($ch); curl_close($ch); } //this will NOT append postfields while(true) { $options = array(CURLOPT_POSTFIELDS => 'foo=bar&foo2=bar'); $ch = curl_init("http://www.example.com"); curl_setopt_array($ch, $options); curl_exec($ch); curl_close($ch); unset($options[CURLOPT_POSTFIELDS]); } ---- Server IP: 64.71.164.2 Probable Submitter: 76.202.168.51 ---- Manual Page -- http://www.php.net/manual/en/function.curl-setopt-array.php Edit -- https://master.php.net/note/edit/104369 Del: integrated -- https://master.php.net/note/delete/104369/integrated Del: useless -- https://master.php.net/note/delete/104369/useless Del: bad code -- https://master.php.net/note/delete/104369/bad+code Del: spam -- https://master.php.net/note/delete/104369/spam Del: non-english -- https://master.php.net/note/delete/104369/non-english Del: in docs -- https://master.php.net/note/delete/104369/in+docs Del: other reasons-- https://master.php.net/note/delete/104369 Reject -- https://master.php.net/note/reject/104369 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#180438) next »