curl-and-php
Re: PHP - CURL - Custom authentication script
Date: Tue, 29 Mar 2011 14:00:58 -0400
Michael,
> Content-Length: 102999
> Content-Type: multipart/form-data; boundary=----------------------------d98e0ca1859e
>
> < HTTP/1.1 500 Internal Server Error
The content length says it: That's a huge string.
The problem is clearly in that $posts string. I see you're building an array. I think curl configures the 'Content-Type: application/x-www-form-urlencoded' for a string instead of 'Content-Type: multipart/form-data' for an array. I can't speak to how to accomplish the task with an array. Instead, I create a string after capturing or setting the variables needed within. Please look at the bottom the server 'request header' from a firefox request and then duplicate that post string. In Live Headers, it is directly beneath the Content-Length: and is indented. It'll most likely look like:
attribute_1=value_1&attribute_2=value_2&....
You might have to use urlencode ( ) on values of the string, to make curl send it like the raw header.
Your problem lies there. It's still a matter of making the curl string be formed like the browsers string. If need be, include the browser's post string in a reply.
David
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2011-03-29