dhendricks Posted September 29, 2008 Share Posted September 29, 2008 Hi, I hope some one can explain this to me. I wrote a bug on the PHP site and they sent it back saying it was not, but told me to find a forum to get the 'why' part of it. I am sending a POST request and needing to get back the mime type. The problem is that PHP cURL returns image/jpeg for the POST request, but text/plain for HEAD and GET requests. Now to compare the return data, I used curl via linux command line. With that I get plain/text across the board (POST, GET, HEAD). Here is my PHP code which returns the mime type of image/jpeg (** should return text/plain): $URL ="http://s7d4.scene7.com/is/image/sample?fmt=png&req=catalogprops,text"; $c = curl_init(); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); curl_setopt($c, CURLOPT_POST, true); curl_setopt($c, CURLOPT_URL, $URL); curl_exec($c); echo curl_getinfo($c, CURLINFO_CONTENT_TYPE); //The important info I need that should return text/plain not image/jpeg curl_close($c); Here is my results from calling curl via linux (Mac OS X) command: deirdra-hendrickss-macbook-pro:~ dhendric$ curl --url "http://s7d4.scene7.com/is/image/sample" -d "fmt=png&req=catalogprops,text" -i HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Last-Modified: Thu, 25 Sep 2008 23:05:41 GMT ETag: "6d16a6640f1e7e88731e9688556b6596" Content-Type: text/plain Content-Length: 466 Expires: Thu, 25 Sep 2008 23:05:43 GMT Date: Thu, 25 Sep 2008 23:05:43 GMT Connection: keep-alive Link to comment https://forums.phpfreaks.com/topic/126302-php-curl-vs-linux-curl/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.