Php 如何在树胶树上发送表单?

Php 如何在树胶树上发送表单?,php,forms,curl,Php,Forms,Curl,如何在树胶树上发送表单?我正在尝试,因为我需要使用curl/php(或perl/Java)来完成。 我不关心电子邮件激活后,它或帐户授权前发送 现在我正在使用这个: <php (...) // Setting POST data // Type of announcement // HTML code of this form radio button: // <input type="radio" name="AdType" value="2" checked> $pos

如何在树胶树上发送表单?我正在尝试,因为我需要使用curl/php(或perl/Java)来完成。 我不关心电子邮件激活后,它或帐户授权前发送

现在我正在使用这个:

<php

(...)
// Setting POST data

// Type of announcement
// HTML code of this form radio button:
// <input type="radio" name="AdType" value="2" checked>
$postData["AdType"]    =    "2";
(...)


// Sending form using cUrl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://www.gumtree.pl/c-ConfirmAd"); //or c-PostAd
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_REFERER, 'http://www.gumtree.pl');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_HEADER, 1);
//curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch,CURLOPT_HTTPHEADER,array('HeaderName: HeaderValue', 'Expect:     \r\n')); // or //Expect: 100-continue


$response = curl_exec ($ch);

//print_r($response);

// Write response to log.html
$file = 'formByCURLandPHP.out.html';
file_put_contents($file, $response);

exit();

url http://

curl_setopt($ch, CURLOPT_REFERER, 'http://www.gumtree.pl');

修复了它,但脚本仍然无法工作:“417-期望失败”$cookie\u文件\u路径值是多少?
curl_setopt($ch, CURLOPT_REFERER, 'http://www.gumtree.pl');