Re: Submitting a web form?
Re: Submitting a web form?
- Subject: Re: Submitting a web form?
- From: Laurent Daudelin <email@hidden>
- Date: Wed, 10 Nov 2010 16:29:28 -0800
Thanks, Conrad. That's a start but given the values that I have to provide back to the server, the sample example didn't help much. I've tried a few variations to set the content of the request's body but the server always return a 400 (bad request). So, I'm guessing that I'm not providing the server with what it expects…
In my example, I need to provide a first name value, a last name value and a password value. The NSURLRequest has to be a POST but how do I provide those values as part of the request?
-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin http://www.nemesys-soft.com/
Logiciels Nemesys Software email@hidden
On Nov 10, 2010, at 16:03, Conrad Shultz wrote:
> On 11/10/10 3:10 PM, Laurent Daudelin wrote:
>> Hello all.
>>
>> I'm downloading a web page that contains a form with NSURLConnection. The form contains a few fields that I can fill with values.
>> Here is the form part:
>>
>> <form id="loginform" action="/openid/loginsubmit" method="post" style="position:relative; style="position:relative;"">
> ...
>> Now, how would I submit it back to the server?
>
> You're basically asking how to send a POST request back to the server
> ('method="post"').
>
> See, e.g.,
> http://www.conceitedcode.com/2010/06/sending-post-data-using-nsurlconnection/
>
> I should point out, though, that this approach is fragile - particularly
> if the remote site is not one you control. If the site changes its form
> structure (particularly, field names) things will suddenly break. Best
> to use a published web API if available.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden