Jump to content

using fgets with fsockopen


rubing

Recommended Posts

I am trying to understand the paypal ipn script, so that I can make something similar.  Their script opens a stream with fsockopen and transmits some data stored in variables $header . $req.  Then the script waits for a 'VERIFIED' message. 

 

I am curious about what is happening on the paypal side.  How do you accept a stream from fsockopen and then reply back as Verified??  What would their code look like??  Thx for any help!

 

 

PayPal Instant Payment Notification Script

$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);

if (!$fp) {
// HTTP ERROR
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0) {

...Script goes on to insert Verified data into database table

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/114950-using-fgets-with-fsockopen/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.