1. Help Converting PHP to Euphoria
- Posted by euphoric (admin) Jan 02, 2009
- 1067 views
I'm trying to set up some ecommerce processing and I don't really know how to code this in Euphoria, although I've tried using wget() to handle it. Does anybody know what I should do with this? Thanks!
PHP 4.1 // read the post from PayPal system and add 'cmd' $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"; $fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30); // assign posted variables to local variables $item_name = $_POST['item_name']; $item_number = $_POST['item_number']; $payment_status = $_POST['payment_status']; $payment_amount = $_POST['mc_gross']; $payment_currency = $_POST['mc_currency']; $txn_id = $_POST['txn_id']; $receiver_email = $_POST['receiver_email']; $payer_email = $_POST['payer_email']; if (!$fp) { // HTTP ERROR } else { fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024); if (strcmp ($res, "VERIFIED") == 0) { // check the payment_status is Completed // check that txn_id has not been previously processed // check that receiver_email is your Primary PayPal email // check that payment_amount/payment_currency are correct // process payment } else if (strcmp ($res, "INVALID") == 0) { // log for manual investigation } } fclose ($fp); } ?>
2. Re: Help Converting PHP to Euphoria
- Posted by gbonvehi Jan 03, 2009
- 1037 views
You could try using eulibcURL (http://raymondsmith.com/euphoria/) it allows you to send post data (forms).
3. Re: Help Converting PHP to Euphoria
- Posted by gbonvehi Jan 03, 2009
- 1079 views
You could try using eulibcURL (http://raymondsmith.com/euphoria/) it allows you to send post data (forms).
I was thinking that you're probably using Linux, as the library is wrapped for Windows, you may try either calling the executable directly or wrapping it on Linux.
4. Re: Help Converting PHP to Euphoria
- Posted by euphoric (admin) Jan 04, 2009
- 999 views
I was thinking that you're probably using Linux, as the library is wrapped for Windows, you may try either calling the executable directly or wrapping it on Linux.
Looks like Michael Sabal's EuNet might work great.
Good news is I've actually got it working using wget.
We shall see...
5. Re: Help Converting PHP to Euphoria
- Posted by jeremy (admin) Jan 04, 2009
- 989 views
eu 4.0 comes with socket.e, which is the TCP/IP library you mentioned. It, however, is just socket.e, I believe Michael's distribution has many additional files such as pop3, imap, etc...
Jeremy