note 109319 added to function.curl-setopt
| From: | adrian at foeder dot de | Date: | Fri, 06 Jul 2012 07:37:58 +0000 |
| Subject: | note 109319 added to function.curl-setopt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-189045@lists.php.net to get a copy of this message | ||
if you want to do a GET request with additional body data it will become tricky not to implicitly
change the request to a POST, like many notes below correctly state.
So to do the analogy of command line's
curl -XGET 'http://example.org?foo=bar' -d
'<baz>some additional data</baz>'
in PHP you'll do, besides your other necessary stuff,
<?php
curl_setopt($curlHandle, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($curlHandle, CURLOPT_POSTFIELDS, '<baz>some additional
data</baz>');
?>
during my experiments, every other "similar" way, like e.g. CURLOPT_HTTPGET, didn't
send the additional data or fell into POST.
----
Server IP: 212.124.37.9
Probable Submitter: 79.214.64.222
----
Manual Page -- http://www.php.net/manual/en/function.curl-setopt.php
Edit -- https://master.php.net/note/edit/109319
Del: integrated -- https://master.php.net/note/delete/109319/integrated
Del: useless -- https://master.php.net/note/delete/109319/useless
Del: bad code -- https://master.php.net/note/delete/109319/bad+code
Del: spam -- https://master.php.net/note/delete/109319/spam
Del: non-english -- https://master.php.net/note/delete/109319/non-english
Del: in docs -- https://master.php.net/note/delete/109319/in+docs
Del: other reasons-- https://master.php.net/note/delete/109319
Reject -- https://master.php.net/note/reject/109319
Search -- https://master.php.net/manage/user-notes.php