note 77568 deleted from function.curl-setopt by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 19:12:50 +0000 |
| Subject: | note 77568 deleted from function.curl-setopt by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155213@lists.php.net to get a copy of this message | ||
Note Submitter: bensan dot benny at vrs-soft dot com
----
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);
?>