note 76219 added to function.curl-setopt
| From: | michaelsky at osu1 dot php dot net | Date: | Thu, 05 Jul 2007 22:09:37 +0000 |
| Subject: | note 76219 added to function.curl-setopt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128253@lists.php.net to get a copy of this message | ||
if you are trying to connect to 'https://...' and after
that want to work with POST data - that's the way:
$curl = curl_init();
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT
5.0)");
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_COOKIEFILE, "cookiefile");
curl_setopt($curl, CURLOPT_COOKIEJAR, "cookiefile"); # SAME cookiefile
curl_setopt($curl, CURLOPT_URL, "url1"); # this is where you first time connect - GET
method authorization in my case, if you have POST - need to edit code a bit
$xxx = curl_exec($curl);
curl_setopt($curl, CURLOPT_URL, "url2"); # this is where you are requesting POST-method
form results (working with secure connection using cookies after auth)
curl_setopt($curl, CURLOPT_POSTFIELDS, "var1=value&var2=value&var3=value&"); #
form params that'll be used to get form results
$xxx = curl_exec($curl);
curl_close ($curl);
echo $xxx;
----
Server IP: 195.54.192.44
Probable Submitter: 85.249.87.100
----
Manual Page -- http://www.php.net/manual/en/function.curl-setopt.php
Edit -- https://master.php.net/note/edit/76219
Del: integrated -- https://master.php.net/note/delete/76219/integrated
Del: useless -- https://master.php.net/note/delete/76219/useless
Del: bad code -- https://master.php.net/note/delete/76219/bad+code
Del: spam -- https://master.php.net/note/delete/76219/spam
Del: non-english -- https://master.php.net/note/delete/76219/non-english
Del: in docs -- https://master.php.net/note/delete/76219/in+docs
Del: other reasons-- https://master.php.net/note/delete/76219
Reject -- https://master.php.net/note/reject/76219
Search -- https://master.php.net/manage/user-notes.php