note 77568 added to ref.curl
| From: | bensan dot benny at vrs-soft dot com | Date: | Tue, 04 Sep 2007 14:35:40 +0000 |
| Subject: | note 77568 added to ref.curl | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-130166@lists.php.net to get a copy of this message | ||
I would like to specify a content-type for a file I am uploading with cURL and yet I find I do not
have any way of doing this. I know that there is a mechanism through the command-line cURL to
specify content-types of files.
I want to set userInfo.xml to have a Content type of "text/xml". Here is my code:
<?php
$postData['userInfo'] = "@userInfo.xml";
$url = "http://curl.dev";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
$response = curl_exec($ch);
print_r($response);
if(curl_errno($ch))
{
print curl_error($ch);
}
curl_close($ch);
?>
----
Server IP: 209.41.74.194
Probable Submitter: 72.242.194.162
----
Manual Page -- http://www.php.net/manual/en/ref.curl.php
Edit -- https://master.php.net/note/edit/77568
Del: integrated -- https://master.php.net/note/delete/77568/integrated
Del: useless -- https://master.php.net/note/delete/77568/useless
Del: bad code -- https://master.php.net/note/delete/77568/bad+code
Del: spam -- https://master.php.net/note/delete/77568/spam
Del: non-english -- https://master.php.net/note/delete/77568/non-english
Del: in docs -- https://master.php.net/note/delete/77568/in+docs
Del: other reasons-- https://master.php.net/note/delete/77568
Reject -- https://master.php.net/note/reject/77568
Search -- https://master.php.net/manage/user-notes.php