Re: Changing perl to PHP

From: Date: Wed, 12 Sep 2001 07:32:33 +0000
Subject: Re: Changing perl to PHP
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-67007@lists.php.net to get a copy of this message
> <?php > $fp = fsockopen("www.paypal.com", 443, $errono, $errstr, 30); > if (!$fp) { > echo "$errstr ($errno)<br>\n"; > } else { > fputs ($fp, "GET https://www.paypal.com/cgi-bin/webscr > HTTP/1.1\015\012"); > fputs ($fp, "HOST www.paypal.com\015\012"); > fputs ($fp, "Content-type: application/x-www-form-urlencoded\015\012"); > fputs ($fp, "Content-Length: ". strlen($query)."\015\012"); > fputs ($fp, "Connection: Close\015\012"); > fputs ($fp, $query); // you might want to do some urlencoding here, if > it hasn't been done already.. > fputs ($fp, "\015\012\015\012"); > while (!feof($fp)) { > $return .= fgets ($fp,128); > } > fclose ($fp); > } > ?> I think this may fail for two reasons - it doesn't look much like valid 'SSL-speak' and, the paypal server possibly requires method 'POST' jason

« previous php.general (#67007) next »