SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2002
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Urgent help with CURL needed (I'll even pay)

    Hello a new site I did is due for launch tomorrow and I have one thing left to fix which doesn't work, hence the urgency. I'll pay something if the price is right to whoever can help me fix this by tonight or tomorrow morning.

    It's about CURL. I am trying to log in a password protected area and then perform an action but I can't seem to keep the login session alive between the two curl actions.
    I log in ok but when I go to execute $ch3 curl is already logged out.
    I thought I solved the issue with the cookie options (I even created a dummy txt file with that name and chmodded it to 777) but it won't stay logged in.

    I've blanked out username and password from my code.

    Thanks to anyone who will take the time.

    PHP Code:
    <? 
           
    // MAMBO admin login 
           
    $url2 'http://www.chaindlk.com/content/administrator/index.php'
           
    $urlstring2 'usrname=XXXXXX&pass=XXXXXX&submit=Login'
           
    $ch2 curl_init(); 
           
    curl_setopt($ch2CURLOPT_URL,$url2); 
           
    curl_setopt($ch2CURLOPT_HEADER0); 
           
    curl_setopt($ch2CURLOPT_POST1); 
           
    curl_setopt($ch2CURLOPT_POSTFIELDS$urlstring2); 
           
    curl_setopt($ch2CURLOPT_FOLLOWLOCATION0); 
           
    curl_setopt($ch2CURLOPT_REFERER'http://www.chaindlk.com/content/administrator/index.php'); 
           
    curl_setopt($ch2CURLOPT_RETURNTRANSFER1); 
           
    curl_setopt($ch2CURLOPT_COOKIEJAR'registration.txt'); 
           
    $data2 curl_exec($ch2); 
       
    // TROUBLESHOOTING 
     
    if ( substr_count(strtolower($data2), strtolower("<script>document.location.href='index2.php';</script>")) >= 
           echo 
    '<script>alert("MOS admin login DONE");</script>'
       
    // TROUBLESHOOTING 
        
         
    if ( substr_count(strtolower($data2), strtolower("<script>document.location.href='index2.php';</script>")) >= ) { 
               
    // COMMUNITY BUILDER user tables synchronization 
             
    $url3 'http://www.chaindlk.com/content/administrator/index2.php?option=com_comprofiler&task=syncUsers'
               
    $urlstring3 'option=com_comprofiler&task=syncUsers'
               
    $ch3 curl_init(); 
               
    curl_setopt($ch3CURLOPT_URL,$url3); 
               
    curl_setopt($ch3CURLOPT_HEADER0); 
               
    curl_setopt($ch3CURLOPT_POST1); 
               
    curl_setopt($ch3CURLOPT_POSTFIELDS$urlstring3); 
               
    curl_setopt($ch3CURLOPT_FOLLOWLOCATION0); 
             
    curl_setopt($ch3CURLOPT_REFERER'http://www.chaindlk.com/content/administrator/index2.php?option=com_comprofiler&task=tools'); 
               
    curl_setopt($ch3CURLOPT_RETURNTRANSFER1); 
               
    curl_setopt($ch3CURLOPT_COOKIEFILE'registration.txt'); 
               
    $data3 curl_exec($ch3); 
               
    curl_close($ch3); 
           
    curl_close($ch2); 
       
    // TROUBLESHOOTING 
       
    if ( substr_count(strtolower($data3), strtolower(&quot;now in sync&quot;)) >= 
           echo 
    '<script>alert("sync DONE");</script>'
       
    // TROUBLESHOOTING 
       

       exit; 
       
    ?>
    PS I never get to the second alert (sync DONE)...
    PPS as you might get from the example to make sure I am actually logged in I check to see if the log in page directs me to the login area (which is index2.php), and I looked at the code, it does it with a js document.location, so that is NOT the issue...

  2. #2
    SitePoint Zealot
    Join Date
    Dec 2002
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ANY ideas?

  3. #3
    SitePoint Zealot
    Join Date
    Dec 2002
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In the meantime the site was launched but I am still tackling with this monster... Can anybody help?
    Could there be any server settings that wouldn't let me use Curl's cookie-related options?
    I just can't explain why the rest of the Curl actions seem to work...
    Thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •