I am trying to figure out the best way to pass a variable to a php script. I know I could add the data into the url like mydomain.org?Name=Rich&Content=Invoice
But I would rather keep the data passed hidden.
If I have a Property of a session like Session.Name = Rich
In php can I read it from the $_SESSION[‘Rich’] variable?
The php stuff I plan to replace uses this a lot, setting a session var in one script and reading it in another.
If there is a way to do this then I could just replace some of the php.
Dim d as New Dictionary
Dim s as New HTTPSocket
d.Value("PName") = "Ricky"
d.Value("PTitle") = "Greatest Hits"
s.SetFormData(d)
s.Post("../test/test.php")
The response from the php script will be returned to your httpsocket, not presented to the user. Collect the result and display it in an htmlviewer or something.
Right, but ultimately, all those chained php scripts will show some kind of page to the user. That is what is returned to your socket. All the rest of it, the processing by authorize.net and the email, will happen as usual, it’s just that last little response to the user that won’t be shown. You can show it directly to the user or show your own indication of success or failure.
One possible issue with your code is that you’re calling the socket in async mode and it’s immediately going out of scope. If that causes a problem, call it synchronously.
Back in 2002 I used Authorize net and sent transactions through an HTML form. I adapted that to WE code from the LR as such. A quick test showed a response from authorize that seems to indicate the gateway is still valid, but you may want to verify.
[code] dim Socket as new HTTPSecureSocket
Dim d As New Dictionary
To get the response page on the screen, place a webhtmlviewer on your page and replace the MsgBox by
HTMLViewer1.LoadPage(result)
You have to add all the fields needed for a correct transaction, including merchant login. The yourreceiptapp.cgi is a script that Autorize net will call with the result of the transaction. At the time I used a Perl script but it can perfectly well be a web app.
1 - Are you sure of the URL you post to ? Do you really have your test.php on the same server as your WE app at …/test/ ? I would tend to prefer an absolute address I can call manually from a browser to make sure.
2 - Not knowing what test.php does, it is difficult to know if it works or not. The code I posted uses the webhtmlviewer in a different way which works perfectly.
Maybe you want to test using the URL given by Xojo in its example for post :
http://httpbin.org/post
I tried it and it responds quite nicely. You can even enter it in a browser and it will naturally tell you that it does not accept get