Wednesday, 11 September 2013

How to send form on gumtree?

How to send form on gumtree?

How to send form on Gumtree? I'm trying, cuz i need to use curl/php (or
perl/Java) to do it. I dont care about email activation after of it or
account authorization before sending.
Right now im using this:
<php
(...)
// Setting POST data
// Type of announcement
// HTML code of this form radio button:
// <input type="radio" name="AdType" value="2" checked>
$postData["AdType"] = "value=\"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);
$response = curl_exec ($ch);
print_r($response);
exit();
What i get back is:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>417 - Expectation Failed</title>
</head>
<body>
<h1>417 - Expectation Failed</h1>
</body>
</html>

No comments:

Post a Comment