I'm trying to do something in PHP that i'm not sure if can be done.
I have built an on-line shopping cart using PHP. Everything works great. I'm using PayPal as method of Payment.
I can process the payment no problem. I can then give PayPal a page to send conformation to, and read the variables they send. That should be no problem either. But, after I read the variables, I am supposed to go open a socket to a paypal page and pass them back some of the variables and the result will tell me if it is valid.
This is the part I don't know if can be done with PHP. I have attached the VB Script I use to do the same thing. Any help would be appreciated.
Thanks...
<%@LANGUAGE="VBScript"%>
<%
Dim str, OrderID, Txn_id, Payment_status
Dim objHttp
str = Request.Form
OrderID = Request.Form("item_number")
Txn_id = Request.Form("txn_id")
Payment_status = Request.Form("payment_status")
' post back to PayPal system to validate
str = str & "&cmd=_notify-validate"
set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
objHttp.open "POST", "https://www.paypal.com/cgi-bin/webscr", false
objHttp.Send str
' Check notification validation
if (objHttp.status <> 200 ) then
' HTTP error handling
elseif (objHttp.responseText = "VERIFIED") then
' process payment
elseif (objHttp.responseText = "INVALID") then
' possible fraud
else
' error
endif
%>