multiform post data using http thingies

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Anant
Forum Commoner
Posts: 66
Joined: Wed Jul 14, 2010 11:46 am

multiform post data using http thingies

Post 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
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: multiform post data using http thingies

Post 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
Post Reply