moola Posted February 9, 2007 Share Posted February 9, 2007 Godaddy does not allow fsocketopen! Does anyone know how to modify the script below to curl? Here's some help. I couldnt figure it out http://www.paypaldev.org/topic.asp?TOPIC_ID=12900. http://www.pdncommunity.com/pdn/board/message?board.id=basicpayments&message.id=4155 http://www.paypaldev.org/topic.asp?TOPIC_ID=13079&SearchTerms=ew,portal <?php require_once($phpbb_root_path . 'includes/lw_ipn_grp_functions.'.$phpEx); // // Set page ID for session management // if(phpversion() <= "4.0.6") { $_POST = ($HTTP_POST_VARS); } // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-validate'; while (list($key, $value) = each($_POST)) { $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 ('www.paypal.com', 80, $errno, $errstr, 30); // Below Instant Payment Notifiction Variables $business = (isset($_POST['business']) ? htmlspecialchars($_POST['business']) : ''); $receiver_email = (isset($_POST['receiver_email']) ? htmlspecialchars($_POST['receiver_email']) : ''); $item_name = (isset($_POST['item_name']) ? htmlspecialchars($_POST['item_name']) : ''); $item_number = (isset($_POST['item_number']) ? htmlspecialchars($_POST['item_number']) : ''); $quantity = (isset($_POST['quantity']) ? htmlspecialchars($_POST['quantity']) : ''); //Advanced and Custom information $invoice = (isset($_POST['invoice']) ? htmlspecialchars($_POST['invoice']) : ''); $custom = (isset($_POST['custom']) ? htmlspecialchars($_POST['custom']) : ''); $memo = (isset($_POST['memo']) ? htmlspecialchars($_POST['memo']) : ''); $tax = (isset($_POST['tax']) ? htmlspecialchars($_POST['tax']) : ''); $option_name1 = (isset($_POST['option_name1']) ? htmlspecialchars($_POST['option_name1']) : ''); $option_selection1 = (isset($_POST['option_selection1']) ? htmlspecialchars($_POST['option_selection1']) : ''); $option_name2 = (isset($_POST['option_name2']) ? htmlspecialchars($_POST['option_name2']) : ''); $option_selection2 = (isset($_POST['option_selection2']) ? htmlspecialchars($_POST['option_selection2']) : ''); // Shopping Cart Information $num_cart_items = (isset($_POST['num_cart_items']) ? htmlspecialchars($_POST['num_cart_items']) : ''); // Transaction Information $pending_reason = (isset($_POST['pending_reason']) ? htmlspecialchars($_POST['pending_reason']) : ''); $reason_code = (isset($_POST['reason_code']) ? htmlspecialchars($_POST['reason_code']) : ''); $payment_date = (isset($_POST['payment_date']) ? htmlspecialchars($_POST['payment_date']) : ''); $txn_id = (isset($_POST['txn_id']) ? htmlspecialchars($_POST['txn_id']) : ''); $txn_type = (isset($_POST['txn_type']) ? htmlspecialchars($_POST['txn_type']) : ''); $payment_type = (isset($_POST['payment_type']) ? htmlspecialchars($_POST['payment_type']) : ''); $payment_status = (isset($_POST['payment_status']) ? htmlspecialchars($_POST['payment_status']) : ''); // Currency and Exchange Information $mc_gross = (isset($_POST['mc_gross']) ? htmlspecialchars($_POST['mc_gross']) : ''); $mc_fee = (isset($_POST['mc_fee']) ? htmlspecialchars($_POST['mc_fee']) : ''); $mc_currency = (isset($_POST['mc_currency']) ? htmlspecialchars($_POST['mc_currency']) : ''); $settle_amount = (isset($_POST['settle_amount']) ? htmlspecialchars($_POST['settle_amount']) : ''); $settle_currency = (isset($_POST['settle_currency']) ? htmlspecialchars($_POST['settle_currency']) : ''); $exchange_rate = (isset($_POST['exchange_rate']) ? htmlspecialchars($_POST['exchange_rate']) : ''); $payment_gross = (isset($_POST['payment_gross']) ? htmlspecialchars($_POST['payment_gross']) : ''); $payment_fee = (isset($_POST['payment_fee']) ? htmlspecialchars($_POST['payment_fee']) : ''); // Auction Information $for_auction = (isset($_POST['for_auction']) ? htmlspecialchars($_POST['for_auction']) : ''); $auction_buyer_id = (isset($_POST['auction_buyer_id']) ? htmlspecialchars($_POST['auction_buyer_id']) : ''); $auction_closing_date = (isset($_POST['auction_closing_date']) ? htmlspecialchars($_POST['auction_closing_date']) : ''); $auction_multi_item = (isset($_POST['auction_multi_item']) ? htmlspecialchars($_POST['auction_multi_item']) : ''); // Buyer Information $first_name = (isset($_POST['first_name']) ? htmlspecialchars($_POST['first_name']) : ''); $last_name = (isset($_POST['last_name']) ? htmlspecialchars($_POST['last_name']) : ''); $address_name = (isset($_POST['address_name']) ? htmlspecialchars($_POST['address_name']) : ''); $address_street = (isset($_POST['address_street']) ? htmlspecialchars($_POST['address_street']) : ''); $address_city = (isset($_POST['address_city']) ? htmlspecialchars($_POST['address_city']) : ''); $address_state = (isset($_POST['address_state']) ? htmlspecialchars($_POST['address_state']) : ''); $address_zip = (isset($_POST['address_zip']) ? htmlspecialchars($_POST['address_zip']) : ''); $address_country = (isset($_POST['address_country']) ? htmlspecialchars($_POST['address_country']) : ''); $address_status = (isset($_POST['address_status']) ? htmlspecialchars($_POST['address_status']) : ''); $payer_email = (isset($_POST['payer_email']) ? htmlspecialchars($_POST['payer_email']) : ''); $payer_id = (isset($_POST['payer_id']) ? htmlspecialchars($_POST['payer_id']) : ''); $payer_status = (isset($_POST['payer_status']) ? htmlspecialchars($_POST['payer_status']) : ''); // Below are Subscription - Instant Payment Notifiction Variables $notify_version = (isset($_POST['notify_version']) ? htmlspecialchars($_POST['notify_version']) : ''); $verify_sign = (isset($_POST['verify_sign']) ? htmlspecialchars($_POST['verify_sign']) : ''); $subscr_date = (isset($_POST['subscr_date']) ? htmlspecialchars($_POST['subscr_date']) : ''); $subscr_effective = (isset($_POST['subscr_effective']) ? htmlspecialchars($_POST['subscr_effective']) : ''); $period1 = (isset($_POST['period1']) ? htmlspecialchars($_POST['period1']) : ''); $period2 = (isset($_POST['period2']) ? htmlspecialchars($_POST['period2']) : ''); $period3 = (isset($_POST['period3']) ? htmlspecialchars($_POST['period3']) : ''); $amount1 = (isset($_POST['amount1']) ? htmlspecialchars($_POST['amount1']) : ''); $amount2 = (isset($_POST['amount2']) ? htmlspecialchars($_POST['amount2']) : ''); $amount3 = (isset($_POST['amount3']) ? htmlspecialchars($_POST['amount3']) : ''); $mc_amount1 = (isset($_POST['mc_amount1']) ? htmlspecialchars($_POST['mc_amount1']) : ''); $mc_amount2 = (isset($_POST['mc_amount2']) ? htmlspecialchars($_POST['mc_amount2']) : ''); $mc_amount3 = (isset($_POST['mc_amount3']) ? htmlspecialchars($_POST['mc_amount3']) : ''); $recurring = (isset($_POST['recurring']) ? htmlspecialchars($_POST['recurring']) : ''); $reattempt = (isset($_POST['reattempt']) ? htmlspecialchars($_POST['reattempt']) : ''); $retry_at = (isset($_POST['retry_at']) ? htmlspecialchars($_POST['retry_at']) : ''); $recur_times = (isset($_POST['recur_times']) ? htmlspecialchars($_POST['recur_times']) : ''); $username = (isset($_POST['username']) ? htmlspecialchars($_POST['username']) : ''); $password = (isset($_POST['password']) ? htmlspecialchars($_POST['password']) : ''); $subscr_id = (isset($_POST['subscr_id']) ? htmlspecialchars($_POST['subscr_id']) : ''); /* Now that IPN was VERIFIED below are a few things which you may want to do at this point. 1. Check that the "payment_status" variable is: "Completed" 2. If it is Pending you may want to wait or inform your customer? 3. You should Check your datebase to ensure this "txn_id" or "subscr_id" is not a duplicate. txn_id is not sent with subscriptions! 4. Check "payment_gross" or "mc_gross" matches match your prices! 5. You definately want to check the "receiver_email" or "business" is yours. */ 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 $PayPal_Data = array( 'ITEM_NUMBER' => $item_number, 'TXN_TYPE' => $txn_type, 'PAYMENT_STATUS' => $payment_status, 'RECEIVER_ACCT' => $receiver_email, 'PAYER_ACCT' => $payer_email, 'MC_CURRENCY' => $mc_currency, 'TXN_ID' => $txn_id, 'MC_GROSS' => $mc_gross, 'GATEWAY_TYPE' => GATEWAY_PAYAPL, ); lw_process_subs_payment_V4($PayPal_Data); } else if (strcmp ($res, "INVALID") == 0) { //do nothing } } fclose ($fp); } die("Process Finished"); ?> Quote Link to comment Share on other sites More sharing options...
Caesar Posted February 9, 2007 Share Posted February 9, 2007 Well, not just that. As someone who works with ecommerce stuff...I can tell you that GoDaddy is the absolute worst when it comes to it. They also do not allow "outgoing" secure connections via port 443. If you're using their hosting...get out now. Find a new host. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.