I'm trying to get my shopping cart to page me when a confirmed sale is put into the databse.
If I create a page with the right form variables and post it, my pager goes off. If I use the following code to send the page automatically it doesn't work. I don't get an error message, and the page refreshes as it should.
I've searched the forums of here and devshed, I think I'm really close, but just missing something. Please help.
<html>
<head>
<title>Post return</title>
</head>
<body>
<?
if (isset($post)) {
//what URL am I sending this to?
$url = "http://www.pagenet.net/pagenet/page_gen";
//What port am I using?
$port= "80";
//these are the variables I want to send
$cont = "sysID=$sid&to=$number&message=$message";
//The length of content
$cont_length = strlen($cont);
//This is the HTTP header for the post reauest
$reqheader =
"POST pagenet/page_gen HTTP/1.0\n".
"Host: <A HREF=\"http://www.pagenet.net/pagenet/page_gen:80/\">[url]www.pagenet.net/pagenet/page_gen:80[/url]</A>\n".
"User-Agent: PostIt\n".
"Content-Type: application/x-www-form-urlencoded\n".
"Content-Length: $cont_length\n\n".
"$cont";
//Print it out to check the data being sent
//print("cont: $cont<br>Length: $cont_length<br>Header: $reqheader");
$response = "";
//ACTUALLY SENDIT!!! *BASH HEAD INTO WALL*
$fp = fsockopen($url, $port, $err_num, $err_msg);
if ($fp) {
fputs($fp, $reqheader);
while (!feof($fp)) {
$response .= fgets($fp, 4096);
}
fputs($fp, "Connection: close\r\n\r\n");
fclose($fp);
}
print("$response");
} else {
print("Enter the message you wish to send.<br>");
}
?>
<form method='post' action='post.php?post=yes'>
<input type='hidden' name='send_page' value='yes'>
<input type='text' name='message'>
<input type='submit'>
</form>
</body>
</html>
The $SID, $NUMBER and $Message are what the pagenet system is looking for.
I've created this same thing with cold fusion for a client, and it took about 25 minutes to set it up and test it. I've been working on this for 5 hours now. PULL OUT HAIR
Thanks for the help!