robison wrote: > I need to use php to send an asynchronous post to a php script. In > other words, I need to post to a script, ignore what it responds, get on > with what I was doing without waiting for it to finish, and meanwhile > the script I called keeps on working without me. I know how to receive > an asynchronous post, because paypal sends an IPN, which is an > asynchronous post. (The reply my IPN handler sends back is just a new > post, its own new event in its own thread.) How can I get my php script > to fire off an async http post like the IPN hit paypal sends? I want to > issue a php script a command it will take a long time to complete, and I > don't want my php script waiting around for the completion of that task > it assigned. Waiting like that causes the called script to occupy its > own memory while my calling script sits on hold occupying all its own > memory too. If my calling script is more memory intensive than the > called script, but the called script simply takes longer, then the total > memory burden on the servers equals the memory space of the calling > script times the run time of the called script. That hogs the server > much more than letting my calling script get it over with and free up > the memory the caller is holding. So I want to know how to get my > calling script to send an async http post to another php script and not > wait for the result. And I need to use php to do it. (I use php 4).
20080809 1050 GMT-6 You can get the IPN php script from paypal. But what I believe happens is paypal posts to your computer a the page you specify, the code on your end checks the values presented to it and then responds back to paypal. The link to paypal script generator is: https://www.paypaltech.com/SG2/ Here is some of that script. $req = 'cmd=_notify-validate'; foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } // post back to PayPal system to validate $header = "POST /cgi-bin/webscr HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; if (!$fp) { // HTTP ERROR } else { fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024); if (strcmp ($res, "VERIFIED") == 0) { ..... Wade
