Debug script invoked as a callback by WorldPay or PayPal |
Guru master
|
On a DebugBreak statement the debug session is attempted on the IP that the request came in from. In your case probably the external IP.
Since the debug listener usually listens on the internal lan only, you might want to add the IP of the debugging PC to the call like so: DebugBreak ( '1@192.168.1.1' ); That is if your pc is on IP 192.168.1.1 of course... if not change into the correct value. The 1 would be the debug session id. If the request comes in on the same PC as the debugger you can also use 127.0.0.1 obviously |
||||||||||||
|
|
Blizz, thanks for the swift response
i am not sure that i understand your suggestion, perhaps i should describe my environment. i am doing my development and testing on my home PC. i allow external HTTP requests to be routed to my PC. I am using PayPal's Instant Payment Notification with my 3rd party shopping cart. After customers press checkout, they are transfered to paypal (using HTTP POST) to complete the payment. Aside from the shopping cart details, the HTTP POST (to paypal) includes the URL that paypal should call when the transaction completed. In an asynchronous fashion, Paypal calls the URL i provided. I would like to be able to debug my PHP code as it is invoked when Paypal call it. I need help to set up PHPED to break in the code when it is called by paypal. thanks a lot |
||||||||||||
|
Site Admin
|
Blizz is correct with his suggestion. You may want to insert DebugBreak() into the code that is called when PayPal posts to the URL. But you also need to provide debugger a way to use your address instead of the address it will detect from the caller IP. That's why you have to specify your own IP where you run DbgListener. |
||||||||||||||
_________________ The PHP IDE team |
|
Dmitri, Blizz,
The syntax for debugbreak() is SESSIONID@IPADDRESS:PORT - is that correct? if so, here are a couple of questions... 1. How do i know what the SESSIONID is if Paypal is the one that invokes the PHP script? 2. What IPADDRESS should i use? is it the NAT address of my PC or the address of PayPal's server who called me? 3. do i have to specify the PORT or this be left out? if needed, what port number should i use? thanks for your patience Alon |
||||||||||||
|
Site Admin
|
DebugBreak accepts the same string as passed with DBGSESSID that triggers debug session if sent with GET, POST or cookies. This page describes DBGSESSID syntax: http://forum.nusphere.com/faq-what-is-dbgsessid-syntax-t586.html
Shortly, yes it should be something like SESSIONID[@IPADDRESORHOSTNAME[:PORT]] (I used square brackets to depict optional parameters) SESSIONID - feel free to use ANY positive numbers (negative are used to drop cookie) IPADDRESORHOSTNAME - is IP address or hostname of the machine where you run DbgListener and IDE (so it's your client machine). PORT is port used for DbgListener. If there is a NAT router between your client machine and host (server) where you run PHP, you have the following two ways to follow: - set port forwarding on your NAT router and EXTERNAL port and EXTERNAL ip is what you need to have in the argument for DebugBreak while INTERNAL ones won't be used anywhere except router configuration. - run SSH tunnel using putty or openssh client and specify localhost or 127.0.0.1 as hostname for DebugBreak. See FAQ topics below: http://forum.nusphere.com/howto-run-debug-session-through-ssh-t580.html http://forum.nusphere.com/tip-troubleshooting-debugger-communications-t579.html http://forum.nusphere.com/howto-run-debug-session-t585.html http://forum.nusphere.com/tip-troubleshooting-debugger-communications-ssh-t581.html |
||||||||||||
_________________ The PHP IDE team |
|
OK, i finally got debugbreak to work and i now understand the communication paths needed to make it work.
Having said that, i was not able to make it work with PayPal IPN. [If my understanding of the DBG communication is correct] PayPal probably has port 7869 blocked so that DBG session setup never completes. in fact, i can tell that debugbreak really stops the code from executing, but phpED does not actually gets engaged and stops in the code. nothing really happens other than the fact that the code lines after debugbreak() don't get executed. is there another way that you may suggest? thanks so much Alon |
||||||||||||
|
Veteran
|
You may look into running dbg over ssh:
http://www.nusphere.com/kb/technicalfaq/php_debugger_ssh.htm |
||||||||||||
|
Site Admin
|
great.
as far as I know, PayPal informs you about transactions by running URL that you provided to them. If this URL points to the same site/hostname where you got debugger to work, it is supposed to work.
they can block that port on their own sites, not on yours. If anybody blocked that port, you would not get debugger to work. |
||||||||||||||||||
_________________ The PHP IDE team |
Veteran
|
When I first read over this thread, I shook my head and thought by myself that this could not be possible. Debugging a script called by a third party? No ways. And then I read it again and it started to make sense
I have now successfully debugged an asynchronous callback from WorldPay. I have not tried a PayPal callback yet, but it I see no reason why it will not work as well. I did have some minor problems with things on the WorldPay side timing out after 60 seconds, but that did not prevent me from completing some lengthy debug sessions. For the record, I am debugging the script on a remote server via an SSH tunnel, and I am invoking the debug session with the DebugBreak ( '1@192.168.1.1' ); statement suggested by Blizz. Very well done Nusphere, PhpED rocks |
||||||||||||
_________________ |
Debug script invoked as a callback by WorldPay or PayPal |
|
||
Content © NuSphere Corp., PHP IDE team
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by