Reply to using curl to peform post

Your name:

Reply:


Posted by Brent Clark on 12/05/05 09:17

Hi all

I have need to simulate the role of a web browser by submitting the following code.

<form name="form1" action="propsearch.pl" method="post">
<textarea rows="12" cols="70" name="msg">GREENc</textarea>
<input type="submit" value="Submit">
</form>

Heres my PHP code that got from the curl function.

<?php

$url = "www.example.com";
$page = "/cgi-bin/ecco/scripts/h2h/glo/propsearch.pl";

$post_string = "msg=GREE01";

$header = "POST ".$page." HTTP/1.0 ";
$header .= "MIME-Version: 1.0 ";
$header .= "Content-type: application/PTI26 ";
$header .= "Content-length: ".strlen($post_string)." ";
$header .= "Content-transfer-encoding: text ";
$header .= "Request-number: 1 ";
$header .= "Document-type: Request ";
$header .= "Interface-Version: Test 1.4 ";
$header .= "Connection: close ";
$header .= $post_string;

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 4);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);

$data = curl_exec($ch); if (curl_errno($ch)) {
print curl_error($ch);
} else {
curl_close($ch);
}

print $data;
?>

Any assistant would gratefully be appreciated.

Kind Regards
Brent Clark

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация