Re: Submitting a web form?
Re: Submitting a web form?
- Subject: Re: Submitting a web form?
- From: Conrad Shultz <email@hidden>
- Date: Wed, 10 Nov 2010 19:28:51 -0800
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 11/10/10 4:29 PM, Laurent Daudelin wrote:
> 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?
Hard to tell what might be going on without seeing the code (and
possibly the live server). As a quick sanity check, make sure you are
using NSMutableURLRequest - NSURLRequest won't respond to, e.g.,
setHTTPBody.
Also make sure that you are POSTing to the form's action URL
(/openid/loginsubmit in your original email), not the page URL. This is
a mistake that's easy to overlook.
I have uploaded a simple Xcode project to
http://dl.dropbox.com/u/5847625/FormPostTest.zip that essentially
implements the contents of the link I previously provided. I replaced
my actual test URL/data with nonsense, but I _did_ test this with a live
server and the server _did_ respond as expected.
Please see the code in the app delegate and let me know if something is
unclear.
Cheers.
- --
Conrad Shultz
Synthetiq Solutions
www.synthetiqsolutions.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iD8DBQFM22LzaOlrz5+0JdURAomXAJ4iqtDteXp5jBeDMIhZDnmhb9vh3wCdGFNs
6Hug+adreejYTdPuceFp4As=
=frpB
-----END PGP SIGNATURE-----
_______________________________________________
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