Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ArtOfWarfare

macrumors G3
Original poster
Nov 26, 2007
9,677
6,216
Is there any way I could use stringWithContentsOfURL: on a page that requires users to log in to a website, for example,

https://forums.macrumors.com/profile.php?do=quotenotifications

?

I'd like the solution to be agnostic of the specific website - I just want the user to enter a URL and optionally login credentials and for them to get the contents of the page.

My program already works with URLs that require no login, and it's useful enough as is, but being able to work on URLs that require a login would be a cherry on top.
 
Im not sure if there would be a 1 size fits all kind of solution to this...

Might need to look into using AFNetworking and using a POST to enter the credentials (not sure if i used the right words to describe it)
 
You could be scanning the page beforehand and search for login form elements, 90% of username inputfields are named 'username','user','login','email'
And password as well, 'pass','password','code'

Based in that you could be 'predicting' how to make a user login by posting that form with user's credentials
 
@OP, If you look at the NSURL class Reference you'll find that NSURL has properties named 'user' and 'password.' If you look at their descriptions you should find the answer to the question.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.