Hi, thanks for the idea, but it didn't help.
response.getHeaders("Location")[0] gives me null. I've also tried to
print all header keys and vaules, and none of them are Location.
Any other ideas?
/J
On Apr 7, 11:12 am, mike <[email protected]> wrote:
> On 04/07/2010 12:40 AM, jw wrote:
>
>
>
> > Hi all,
>
> > thanks for your time and sorry that I wasn't clear enough.
>
> > I'm making a http post request to a web page which redirects me to
> > different urls depending on the accuracy of my parameters sent in the
> > request. This means that if I do it correct, I'll get redirected to
> > for examplewww.google.comwith a querystring that I need to get
> > (www.google.com?x=1y=2). Maybe that's not the response url, but I
> > don't now how to describe it. It's not the same as the request url
> > anyway.
>
> > I'm able to get the response status code from the repsonse object,
> > which is ok, and I'm also able to get the html (content) of the
> > response. I just need to know what url I was redirected to. Does this
> > help you? I'm very thankful for all help
>
> sounds like you want to use HttpResponse.getHeaders("Location")
>
> Mike, it returns an array, but there should only be one if it redirected
>
> > /J
>
> > On Apr 7, 5:31 am, Kevin Duffey<[email protected]> wrote:
>
> >> There isn't a response URL that is any different than the request URL. It's
> >> not as if the server appends a bunch of stuff to the URL you submit the
> >> request to unless it redirects/forwards to another URL.. in this case, the
> >> server would append to the URL you requested, redirecting you... but even
> >> if
> >> it did this, your response would indicate a 3xx redirect and the Location
> >> header, as Frank says above, would contain the new URL you should go to. If
> >> you did get a 301/2 back, you'd have to actually make another request
> >> yourself.
>
> >> So not sure as the other guys say, what URL you are talking about
>
> >> On Tue, Apr 6, 2010 at 7:59 PM, Frank Weiss<[email protected]> wrote:
>
> >>> I don't know what "response URL" means. The only URLs in an HTTP response
> >>> that come to mind are: 1) the "Location" response header for a 301/302
> >>> status code, 2) some string in the response data (such as an HTML anchor
> >>> element) that you want to interpret as a URL.
>
> >>> On Tue, Apr 6, 2010 at 1:59 PM, jw<[email protected]> wrote:
>
> >>>> Hi all,
>
> >>>> I have a problem. I'm doing a http post request to a URL like this;
>
> >>>> DefaultHttpClient httpclient = new DefaultHttpClient();
> >>>> HttpPost httppost = new HttpPost(url);
> >>>> HttpResponse response = httpclient.execute(httppost);
>
> >>>> I am able to get the response content (html in this case) but I would
> >>>> like to be able to get the url of the response. Is there a way? Or
> >>>> could i use some other technique to do the post request and retrieve
> >>>> the url?
>
> >>>> The repsonse url is
> >>>> lkewww.url.com?x=1&y=2<http://www.url.com/?x=1&y=2>and would like to get
> >>>> the
> >>>> parameter values, I've tried to use the getParams().getParameter() on
> >>>> the HttpResponse object without any success. So if anyone has a
> >>>> solution to get the parameters without getting the url, that's ok :)
>
> >>>> Thanks in advance.
>
> >>>> /J
>
> >>>> --
> >>>> You received this message because you are subscribed to the Google
> >>>> Groups "Android Developers" group.
> >>>> To post to this group, send email to [email protected]
> >>>> To unsubscribe from this group, send email to
> >>>> [email protected]<android-developers%[email protected]>
> >>>> For more options, visit this group at
> >>>>http://groups.google.com/group/android-developers?hl=en
>
> >>>> To unsubscribe, reply using "remove me" as the subject.
>
> >>> --
> >>> You received this message because you are subscribed to the Google
> >>> Groups "Android Developers" group.
> >>> To post to this group, send email to [email protected]
> >>> To unsubscribe from this group, send email to
> >>> [email protected]<android-developers%[email protected]>
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en