I have a PH开发者_JAVA技巧P script set up that makes cURL requests whenever an action is performed on a site. The problem is that the information is being POSTed twice whenever the action is run.
I need to work out if this is a problem on my end (cURL is being run twice) or the URL it's POSTing to is doing something twice.
I imagine the best way to do this would be to view the outgoing http POST requests from the server.
Is this the best option? If so, how do I go about it?
Certainly sensible. You use the error_log
function just before making the cURL call, and set up the head of your file with ini_set('error-log', 'filename');ini_set('log_errors',TRUE);
. Then, you run the page a few times and check the file, which will tell you exactly how many times the cURL request was made.
cURL is highly reliable. Either your code is doing something wrong, and calling cURL twice, or the service you're posting to is silly. (I always suspect myself first, so log all errors and subscribe a feed of the file for live sites.)
精彩评论