Php + curl + cookies

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PPC
    Registered User
    • Jun 2007
    • 60

    #1

    Php + curl + cookies

    Anyone have a working example of logging into a protected area and navigating to another page using php, curl & cookies, oh my


    I can get logged in, but that's about it.
    Pay Per Click
  • PPC
    Registered User
    • Jun 2007
    • 60

    #2
    bump4help
    Pay Per Click

    Comment

    • PPC
      Registered User
      • Jun 2007
      • 60

      #3
      guess i'll try a different forum :|
      Pay Per Click

      Comment

      • wizzart
        scriptmaster
        • May 2006
        • 5246

        #4
        It's possible only if you have login info for that portected area.

        curl is perfect for that.
        BimboZone

        Comment

        • PPC
          Registered User
          • Jun 2007
          • 60

          #5
          yeah , I have login info

          I can login just having problems navigating to a page and submitting a form (I can submit forms while not logged in.. but I need to login and submit this one and cant)

          just need to submit a form to add record to db while logged in and having problems

          any help would be appreciated
          Pay Per Click

          Comment

          • woj
            <&(©¿©)&>
            • Jul 2002
            • 47882

            #6
            curl_setopt + CURLOPT_COOKIE FTW
            Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
            Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
            Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager

            Comment

            • jwerd
              Confirmed User
              • Jun 2003
              • 1953

              #7
              Originally posted by woj
              curl_setopt + CURLOPT_COOKIE FTW
              what he said
              Yii Framework Guru - Seasoned PHP vet - Partner @ XXXCoupon.com

              Comment

              • PPC
                Registered User
                • Jun 2007
                • 60

                #8
                here's what I have that logs in and visits another page that shows I'm logged in. I just cant submit a form after this. I need to visit the submit form to grab values from it

                I've tried every thing that doesn't work
                PHP Code:
                curl_setopt($ch, CURLOPT_URL, 'http://my.com/login.php?');
                curl_setopt ($ch, CURLOPT_POST, 1);
                curl_setopt ($ch, CURLOPT_POSTFIELDS, 'username=PPC&password=madcharacters');
                curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
                curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
                $store = curl_exec ($ch);
                stufffff
                curl_setopt($ch, CURLOPT_URL, 'http://my.com/add.php');
                $2ndpagecontent = curl_exec ($ch);
                echo $2ndpagecontent; 
                
                Last edited by PPC; 07-25-2009, 08:29 PM.
                Pay Per Click

                Comment

                • PPC
                  Registered User
                  • Jun 2007
                  • 60

                  #9
                  i got it its a beautiful thing

                  thank u 51bot

                  all bout tha keywords
                  Pay Per Click

                  Comment

                  Working...