1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to visit another page after login in using curl?

Discussion in 'PHP & Perl' started by hawkweb, Jan 12, 2013.

  1. hawkweb

    hawkweb Regular Member

    Joined:
    Aug 18, 2009
    Messages:
    375
    Likes Received:
    21
    Hello
    I have finally found a away to login into a website but now can someone help me on a way to visit another internal page after login in?

    Thanks
     
  2. chevet

    chevet Junior Member

    Joined:
    Jun 23, 2010
    Messages:
    168
    Likes Received:
    48
    Log in using cookie file and then use it to browse pages. First generate cookiefile:

    PHP:
    $cookiefile tempnam("dir_name_for_cookies"uniqid());
    and in every curl request add:

    PHP:
    curl_setopt($chCURLOPT_COOKIEFILE$cookiefile);
    curl_setopt($chCURLOPT_COOKIEJAR$cookiefile);
     
  3. mmkevin

    mmkevin Newbie

    Joined:
    Feb 27, 2012
    Messages:
    14
    Likes Received:
    1
    Don't use cookies use php redirect
     
  4. firescape

    firescape Newbie

    Joined:
    Feb 1, 2013
    Messages:
    10
    Likes Received:
    0
    He's asking on how to reirect (internally). I think you mean that you want the page embedded. Well then just use an iframe.
     
  5. davidstone

    davidstone Newbie

    Joined:
    May 28, 2012
    Messages:
    8
    Likes Received:
    0
    use 'simple dom' and php curl libary
     
  6. cashmaster

    cashmaster Junior Member

    Joined:
    Dec 25, 2010
    Messages:
    146
    Likes Received:
    17
    Just use the following code:

    The above code ought to represent how you login. Replace $post with your POST query that you use to login. After that, before closing the curl, do the following too.

    That shall enable you to redirect to any internal pages as LOGGED IN.