Page 1 of 1

multiform post data using http thingies

Posted: Thu Dec 23, 2010 5:02 am
by Anant
Hi,

I need to pass csv file data using special multiple part form post to client system -

The example they gave is -

Code: Select all

POST /interface/list_upload_data.php HTTP/1.1
Host: response.pure360.com
User-Agent: www.xyz.com upload process
Accept: text/plain
Accept-Language: en
Accept-Encoding: gzip
Accept-Charset: ISO-8859-1
Keep-Alive: 3600
Connection: keep-alive
Referer: http://www.xyz.com/uploadRequest.jsp
Content-Type: multipart/form-data; boundary=---------------------------
25578952812662351891242608872
Content-Length: 516
-----------------------------25578952812662351891242608872
Content-Disposition: form-data; name="profileName";
myProfile
-----------------------------25578952812662351891242608872
Content-Disposition: form-data; name="123456789"; filename="listData.csv"
Content-Type: text/plain
john.smith@email.com,John Smith,07798564352,Brighton
sarah.jones@email.com,Sarah Jones,0779646352,London
bob.samuel@email.com,Bob Samuel,0775354542,Cardiff
-----------------------------25578952812662351891242608872--
I can see few others had problem implementing this at this site http://forums.asp.net/p/1449713/3305985.aspx

Any ideas how can i achieve above task using php ?

Thanks

Re: multiform post data using http thingies

Posted: Thu Dec 23, 2010 6:08 am
by Darhazer
You can use curl -> set post vars to profileName=myprofile&123456789=@listData.csv
this will create a multipart/form-data request, adding the file contents for the 123456789 parameter
Or you have to use sockets