Skip to content Skip to sidebar Skip to footer

Trying To Make Get Request In Objc Using Nsurl

I'm trying to make this request in an iOS app I've already logged into the website using NSURLConnection, the following code is in the completion handler: NSMutableURLRequest *req

Solution 1:

Doing a little testing, i have confirmed that you have to do the following four NSURLConnection or NSURLSession requests:

  • Login at /novi/StudentPortal/Home/Login

  • Go to the portal page at /novi/StudentPortal/Home/PortalMainPage

  • Set the student banner /novi/StudentPortal/StudentBanner/SetStudentBanner/XXX, where XXX is the id value for the row associated with the particular student in the portal page

  • Request the assignments from novi/StudentPortal/Home/LoadProfileData/Assignments (no ?_=xxxx parameters needed; it looks like AjaxLoad Javascript used that to keep track of the requests, but we don't have to worry about that here)

I notice that if you skip either of those middle two steps, the request for the assignments will fail, as shown in your question. (Frankly, this makes me question some of the design choices in that system you're interfacing with, but I assume you have no say over that.) But if you do all four, you'll get the HTML associated with the assignments.

By the way, while parsing this HTML, you might be inclined to use NSXMLParser or regular expressions, but I'd suggest you consider Hpple (see Ray Wenderlich's article on parsing HTML).

Post a Comment for "Trying To Make Get Request In Objc Using Nsurl"