Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
Hi, I'm having trouble getting a response (or even sending data) with my application. I'm a real noob, so please bear with me ;) I'm using the ASIHTTPRequest. The setup is so that when i press a button, the response will show up in a label.
1. The form on the site has method = post (according to the source code). the different boxes, first name and last name, has both a "name" and an "id". Which one whould i use after "forKey"?
2. Am I using the error correct?
3. Will the response thing work, as I have written it now?
Huge thanks if you answer any of these questions :D
Hi, tried on my netbook instead, and got the same error as you. Then i added a / in the end of the url, and got a different error message! Making progress ;)
EDIT: It's not a error! I's actually a real connection to the server! Thank you for the help, you are awesome! :D
EDIT2: Ok, I now have a response from the server, but the response seems to be the source code of the side before I have made the search, and not after. Do you have any ideas?
There's a hidden form variable called __VIEWSTATE that probably has something to do with it. Your best bet would be to trace what a real web browser posts to that form, use something like the Charles Debugging Proxy.
I can't read swedish so I don't know what the point of that site is, but I'm guessing you want to simulate entering data into that form and clicking the submit button. If so, you are on the right track, but you need to make your form post contain all the variables that a real web browser would submit. If you look at the source of that page you'll see some hidden form fields in the form. If you don't pass those, I'm guessing that's what makes the server generate the Invalid Operation message. So you're gonna need to do some detective work to figure out exactly what's going on when you hit submit in your web browser, and try to mimic it using ASIFormDataRequest parameters. Good luck!
Replies
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- (IBAction)pReSsEd:(id)sender {
NSURL *url = [NSURL URLWithString:@\"http://www.birthday.se/sok\"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setRequestMethod:@\"GET\"];
[request setPostValue:@\"Johan\" forKey:@\"ctl00$cphContent$txtFirstname\"];
[request setPostValue:@\"Svensson\" forKey:@\"ctl00$cphContent$txtLastname\"];
[request start];
NSError *error = [request error];
if (!error) {
NSString *response = [request responseString];
sTaTuS.text = response;
}
else {
sTaTuS.text = @\"Phail!\";
}
}
But it still gives me the Phail! message...
(also updated the code with the real url)
Got any ideas?
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeChanged the line to:
Appreciate your help ;)
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome"
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeHere is the real deal, would you mind to run it again? :)
- (IBAction)pReSsEd:(id)sender {
NSURL *url = [NSURL URLWithString:@\"http://www.birthday.se/sok\"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setPostValue:@\"Johan\" forKey:@\"ctl00$cphContent$txtFirstname\"];
[request setPostValue:@\"Svensson\" forKey:@\"ctl00$cphContent$txtLastname\"];
[request start];
NSError *error = [request error];
if (!error) {
NSString *response = [request responseString];
sTaTuS.text = response;
}
else {
sTaTuS.text = [error localizedDescription];
}
}
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeEDIT: It's not a error! I's actually a real connection to the server! Thank you for the help, you are awesome! :D
EDIT2: Ok, I now have a response from the server, but the response seems to be the source code of the side before I have made the search, and not after. Do you have any ideas?
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesomeit ads first a "?" and then f (for fistname) = johan & l (last) = svensson.
Don't really know what i whould do with it...
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome$var = $_GET["f"];
View my portfolio - My iPhone Applications<
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome