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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to