stringWithContentsOfURL: login credentials?

Discussion in 'iOS Programming' started by ArtOfWarfare, Aug 12, 2013.

  1. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #1
    Is there any way I could use stringWithContentsOfURL: on a page that requires users to log in to a website, for example,

    http://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.
     
  2. truehybridx macrumors member

    Joined:
    Dec 6, 2010
    #2
    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)
     
  3. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
  4. yaymath macrumors regular

    Joined:
    Jan 8, 2011
  5. DennisBlah macrumors 6502

    DennisBlah

    Joined:
    Dec 5, 2013
    Location:
    The Netherlands
    #6
    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
     
  6. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #7
    @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.
     

Share This Page