Issue
I am trying to use Netbeans/PHP/XDEBUG for debugging API PUT request with JSON body. When I am executing (from Netbeans) 'Debug - Debug project', then Netbeans open Firefox web browser with the URL from the 'Project - Properties - Run Configuration'. Run configuration is for GET requests only and I can provide query string parameters, but there is no field for JSON body and no option that PUT request should be made. So, while I would like to receive PUT request with my custom JSON body, Netbeans only issues GET without body. So, this actually makes the use of XDEBUG from Netbeans impossible for PUT requests.
Or - is there any trick how to create Run configuration for PUT/JSON body and how to use this run configuration when the project debug is started?
I am using Netbeans 11.0 and I would be happy to upgrade, if necessary. But I am not sure that there are more options regarding my situation in the latest edition of Netbeans.
Solution
I don't know about Netbeans, but you can Xdebug's xdebug.start_with_request=yes
and it will initiate a debug connection to the IDE for every webserver request.
For this to work, you need to put your IDE (Netbeans) in listen mode and how to do that is explained in https://stackoverflow.com/a/1544745/508057 :
go to project properties > run configuration > advanced > debug url and check do not open web browser. Do not set the host under debugger proxy. Save these settings. In the project window, on your project: right mouse click > debug (this starts listening for debug connections).
And then make your request in the browser, or with curl, or any other way.
Answered By - Derick
Answer Checked By - Willingham (JavaFixing Volunteer)