使用PUT方法和cURL填充表格

时间:2016-12-11 14:47:36

标签: forms automation header put autofill

我需要填写表单然后将数据发送到服务器。为了模拟表单填写和按钮提交,我试图使用PUT方法和cURL,但没有任何成功。 我不知道我做错了什么因为我在使用cURL方面不是很有经验。感谢所有人的帮助。

我在manualy提交表单时可以看到这些标题:http://www.krafty.cz/headers.txt

这是我的代码:

$data = array(
'authenticity_token' => 'uGjjg9Jv4E5s4FE9e6afza9v1ycIR9sdAAnvmjcGf8YeUl0+UzpsaT5p/I/LIFs/kbOb7g4TmWx5Pq+TGt7V1Q==',
'show_preview' => '1',
'product[international]' => '0',

// *** THERE IS MUCH MORE FIELDS IN ARRAY HERE, ACCORDING TO HEADERS

'product[auto_renewable]' => 'true',
'button' => ''
); 

$curl = curl_init('http://en.dawanda.com/seller/products/new');

curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded','authenticity_token:   uGjjg9Jv4E5s4FE9e6afza9v1ycIR9sdAAnvmjcGf8YeUl0+UzpsaT5p/I/LIFs/kbOb7g4TmWx5Pq+TGt7V1Q=='));
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));

$response = curl_exec($curl);

0 个答案:

没有答案
相关问题