My iPhone app needs to call two different APIs. Identical calls produce different results:
works just fine and gives the proper response from the targeted API, while
leads to an HTTP client error with a status = 500, meaning the sending server has an issue. Adding 'www.' to the second one makes no difference. This is completely puzzling (and very frustrating) to me. Anybody have an idea what might be going on here? Are there certain APIs Appcelerator just doesn't like?
Titanium's HTTPClient is just doing vanilla HTTP. It doesn't care what is on the other end.
My suspicion is that the server doesn't like the way the entire HTTP request is being presented. That's a lot more than just the URL. It's all the various headers that go with the request. User-Agent and Cookie would be the most likely culprit.
I would suggest making a request to the xurrency API using something like curl. Examine the headers closely. If curl can't make the request work, look into the reasons why.
If it does work, try to figure out the difference between curl's request and HTTPClient's request. You can use something like wireshark to capture the request/response.
But the short answer is that there's nothing inherently "wrong" with the Titanium HTTPClient. But it's default requests might be different from other clients in subtle ways that can cause a server to reject the request (or worse, bail out with a 500 error).
Think you can help? Login to answer this question!