note 77568 modified in ref.curl by danbrown

From: Date: Sun, 17 May 2009 19:12:41 +0000
Subject: note 77568 modified in ref.curl by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-155212@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); ?> --was-- 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); ?> http://php.net/manual/en/ref.curl.php

« previous php.notes (#155212) next »