well then, Praise the Lord, cuz the script is working properly. In practical cases you dunt have to check what the function returns EXCEPT this:
if (isset($Result["errno"])) {
$errno = $Result["errno"]; $errstr = $Result["errstr"];
echo "<B>Error $errno</B> $errstr";
exit;
}
Put whatever you want to do after the post has been SUCCESSFUL in the else clause of the above code.
To make sure the POST is working, i made the following snipplet that will write the POSTed data to a txt file. Now b careful abt File write permission n the whole deal b4 actually looking 4 the written file.
test1.php:
<?php
require ('postIt.php');
$d["foo"] = "some";
$d["bar"] = "data";
$Result = PostIt($d, "http://www.mydomain.com/test2.php");
if (isset($Result["errno"])) {
$errno = $Result["errno"]; $errstr = $Result["errstr"];
echo "<B>Error $errno</B> $errstr";
exit;
} else echo 'Post was completed successfully';
?>
and the page it submits info to: test2.php has the following:
<?php
$data = '';
while (list($key, $val) = each($_POST)) {
$data .= "$key => $val\r\n";
}
$fp = fopen('postData.txt','w');
fwrite($fp,$data);
fclose($fp);
?>
Now after the script successfully excecutes itself, chk for a file named postData.txt which shudd contain:
foo => some
bar => data