0

The title is a bit confusing. In my Android app, I am making an HttpGet request using HttpClient object. I am not setting any headers so all default values. The request works fine and i get the response from the server.

The problem is that when the same url is requested using HTTP GET request from iphone, the servers response is different. So the server is looking at something, USER-AGENT may be or something else, to decide what to return. I want the same thing as the server returns to iphone app. What can I do i.e what parameters, headers or whatever can I set to make this request same as ios app.

PS: I have tried setting User-Agent to

"Mozilla/5.0(Linux; U; Android 2.2; en-gb; LG-P500 Build/FRF91) 
AppleWebKit/533.0 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1" \

using following code..

client.getParams().setParameter(CoreProtocolPNames.USER_AGENT, sUsrAgent);

also plz do not suggest checking server or making changes to the webservice as I do not have access to it.

Praful Bhatnagar
  • 7,425
  • 2
  • 36
  • 44
binW
  • 13,220
  • 11
  • 56
  • 69
  • Have you really had _Linux_ and _Android_ in the string you set as the _USER_AGENT_? Because it should only contain the original iPhone string. – class stacker Feb 19 '13 at 12:32
  • if you run both applications on emulator ( android -emulator, iPhone-simulator) and use wireshark on machine to check the response. if u post the response, we can see the difference.. – Rohit Feb 19 '13 at 12:33
  • Seems like you're doing it right: http://stackoverflow.com/a/3905534/752781 Please clarify where are you having trouble – pandre Feb 19 '13 at 12:34

1 Answers1

0

Can you try to hit a site like this from iPhone application and check the HTML response. It would contain the list of headers passed by the iOS network API. Once you have this list then you can try to add all the headers in the Android app..

Praful Bhatnagar
  • 7,425
  • 2
  • 36
  • 44
  • This is actually a good idea. Let me try it. If this solves my problem I will accept the answer – binW Feb 19 '13 at 12:38