Almost any working PHP programmer has faced having to use CURL to send raw HTTP requests, whether it\'s for credit card payment processing, nefarious screen scraping, or somethi
Actually, I never use CURL (in php). The PHP stream api is much neater, and can be used to POST data as well. Wez Furlong has an article about this.
If I were to use it? I'd start with turning on all messages (setting error reporting to E_ALL). If I find that PHP doesn't tell me what I need in the error messages, I'd probably use a proxy approach to see what's actually going on. Changing the target url to a local php page containing something like
is one way. Another way is to use a utility like netcat to listen on port 80 and send the request there:
netcat -l -p 80
This won't return anything to curl, but it will allow you to see exactly what is sent the server, which might be enough to diagnose the problem.
You can also retrieve the headers from PHP using the apache_request_headers() function. In most cases I prefer the netcat approach, though, since it guarantees that I see the unmodified truth, and also display the raw post data.