Dependent Origination

Posts Tagged ‘post

The third-party provides example scripts using command line curl and they work well — so you know it must be your problem. The question is how to figure out what your problem is.

Things I find useful along the way:

1. Postman Google Chrome Extension — you can search it in Chrome Web Store — very easy to use, simple and intuitive interface, really good tool to try out an HTTP API

2. Luckily our C++ code of a HTTP client can print out the raw request if you lower the debug level so I get a raw HTTP request easily. You have to figure out if using other bindings/libraries.

3. Use netcat host port < request.txt to send the host a raw http request you obtain from step 2. you can tweak your raw request here to make it work 🙂 you can use telnet host 80 and paste that request too but netcat is better if you tweak your requests.

4. Unfortunately you cannot make it work with simple tweaks. the only thing now is getting the raw request from the working third-party script  and compare to our own. Curl makes it easy: use –verbose or –trace-ascii. –verbose in fact prints out the request (sans the actual form data part) while –trace-ascii is only printing out what curl receives from the host, so it is a little different from what Curl tutorial is saying about http scripting.

5. At this point, the two raw requests compare nicely: I am sending out the wrong Content-Type header and change it. All set.

Feel really good about figuring out this myself 🙂

For reference, this page lists the basics of HTTP GET/POST nicely.


April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

Flickr Photos

Archives