We have faced some issues with posting form details using cURL module of php.
A form having file upload option was not posted correctly.
The content type is multi-part/form-data for this form.
The below line of code will set the post fields for the curl session.
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fiels);
The $post_fields can be specified either as querystring parameters or as an associative array.
Initially we had specified the $post_fields as querystring paramter as $post_fields="field1=value1&field2=value2";
But this approach didn't work for the multi-part/form-data forms.
It works fine after changing this code using an associative array as below.
$post_fields = array("field1" => "value1", "field2" => "value2");
More Articles...
Popular Posts
- Software Testing Quiz Questions and Answers
- Javascript Quiz Questions and Answers
- MySQL Quiz Questions and Answers
- SEO Your Blog the Easy Way - Guest Post
- SEO (Search Engine Optimization) Quiz Questions and Answers.
- PHP Quiz Questions and Answers
- Basic Computer Hardware Quiz Questions and Answer.
- Use of tinyurl in Twitter
- HTML Quiz Questions and Answers
- General Knowledge Quiz Questions and Answers

No comments:
Post a Comment