Jump to content

curl data array post +multipart/form-data


bhavin12300

Recommended Posts

hi experts,

i got stuck during my project, need bit of your advice to find correct path.

 

here is what i am doing in my php code.

1)my script create account on third party website(i have no control over this website)

 

2)there are 5 forms which i have to submit one by one to create account.

 

3)ii have successfully created code to submit first two forms and after submitting second form , i am getting third form in my response in script.

 

4)but when i am submitting data for third form, i am getting response in red text that "Please fill up all fields", i am getting this error message, which means that my code is submitting values to "action" form of third form, but some how  its not accepting it or may be possible, my curl doing something wrong while sending data.

 

all 5 forms are accepting data of content-type "multipart/form-data" and thats y i am sending all my data in array and assigning that array to "CURLOPT_POSTFIELDS".

 

following is data send by browser to "action" script of form 3.

 

-----------------------------792694871670
Content-Disposition: form-data; name="1"

(Car#21)
-----------------------------792694871670
Content-Disposition: form-data; name="2"

(Car#22)
-----------------------------792694871670
Content-Disposition: form-data; name="3"

(Car#23)
-----------------------------792694871670
Content-Disposition: form-data; name="4"

(Car#24)
-----------------------------792694871670
Content-Disposition: form-data; name="5"

(Car#25)
-----------------------------792694871670
Content-Disposition: form-data; name="6"

(Car#26)
-----------------------------792694871670
Content-Disposition: form-data; name="7"

(Car#27)
-----------------------------792694871670
Content-Disposition: form-data; name="8"

(Car#28)
-----------------------------792694871670
Content-Disposition: form-data; name="9"

(Car#29)
-----------------------------792694871670
Content-Disposition: form-data; name="10"

(Car#30)
-----------------------------792694871670
Content-Disposition: form-data; name="19.0.x"

42
-----------------------------792694871670
Content-Disposition: form-data; name="19.0.y"

9
-----------------------------792694871670--

 

and following is array i am posting using curl.

 

                        $data_arry3["1"]="(Car#21)"; 			
		$data_arry3["2"]="(Car#22)"; 			
		$data_arry3["3"]="(Car#23)"; 			
		$data_arry3["4"]="(Car#24)"; 			
		$data_arry3["5"]="(Car#25)"; 			
		$data_arry3["6"]="(Car#26)"; 			
		$data_arry3["7"]="(Car#27)"; 			
		$data_arry3["8"]="(Car#28)"; 			
		$data_arry3["9"]="(Car#29)"; 			
		$data_arry3["10"]="(Car#30)"; 			
		$data_arry3['19.0.x']="58"; 			
		$data_arry3['.0.y']="4"; 		

 

as far as i know, session,cookies and ref everything seems ok because, i am able to submit first two forms.

 

i think problem is in data being send by curl to that server, something has changed by curl in data before sending to server, the reason i am saying this name of fields are numbers not alphabet.  may be  i am wrong.

 

so experts any one can let me know whats i am doing wrong??

any advice will sure take me out of this.

 

please if any question do let me know.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.