English 中文(简体)
Curl setting Content-Type incorrectly
原标题:
  • 时间:2009-11-16 22:39:46
  •  标签:
  • curl
  • youtube

I am running a curl operation on the command line and am having trouble forcing the header to set as XML. I use the -H option to force the Content-Type to be xml, however, once I run the command I can see that the header is sent as urlencoded which is tainting one of the data values that I m sending. Can someone explain to me why the Content-Type is always reset back to "application/x-www-form-urlencoded" instead of "application/atom+xml"?

I am using this to retrieve an upload token from YouTube using their API. I have no trouble retrieving an authentication token using a similar command.

curl -S -v 
--location http://gdata.youtube.com/action/GetUploadToken
-H Content-Type= text/xml
--data content=some xml content here
--data GoogleLogin auth="DQAAAHU.....TiU95NXYSLFFENTbNQUy....NjfFoC0nyEKaz-ejEkA_w"
-H X-Gdata-Key: key=AI39si5EQyo-_L......78eL80r-MooHXtrA48R82AShoQ
-H Content-Length=445
最佳回答

I think you want to specify

-H "Content-Type:text/xml"

with a colon, not an equals.

问题回答

暂无回答




相关问题
curl + sessions

I m making POST requests with CURL, and I would like to output cookies made during that request... Is that possible? :)

Curl setting Content-Type incorrectly

I am running a curl operation on the command line and am having trouble forcing the header to set as XML. I use the -H option to force the Content-Type to be xml, however, once I run the command I can ...

Create new etherpad using PHP and CURL

I m trying to write a simple PHP script which automatically sets up new etherpads (see http://etherpad.com/). They don t have an API (yet) for creating new pads so I m trying to figure if I can do ...

Finding out where curl was redirected

I m using curl to make php send an http request to some website somewhere and have set CURLOPT_FOLLOWLOCATION to 1 so that it follows redirects. How then, can I find out where it was eventually ...

热门标签