Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: PHP curl help

  1. #1
    New Coder
    Join Date
    Nov 2009
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile PHP curl help

    i donno whether my question has issues here
    i want to login www.codingforums.com via php curl
    the code i was using is :
    PHP Code:
    <?php
    $url 
    "http://www.codingforums.com/login.php?do=login";
    $postfields "vb_login_username=java_freak&vb_login_password=&s=&securitytoken=&do=login";
    $cookie_file_path "cookiejar.txt";
    $fp fopen("$cookie_file_path","w") or die("<BR><B>Unable to open cookie file $mycookiefile for write!<BR>");
    fclose($fp);
        
    $agent "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";
        
    $ch curl_init();
        
    curl_setopt($chCURLOPT_URL,$url);
        
    curl_setopt($chCURLOPT_POST1);
        
    curl_setopt($chCURLOPT_POSTFIELDS,$postfields);
        
    curl_setopt($chCURLOPT_USERAGENT$agent);
        
    curl_setopt($chCURLOPT_RETURNTRANSFER1);
        
    curl_setopt($chCURLOPT_FOLLOWLOCATIONTRUE);
        
    curl_setopt($chCURLOPT_COOKIEFILE$cookie_file_path);
        
    curl_setopt($chCURLOPT_COOKIEJAR$cookie_file_path);
        
    $result curl_exec ($ch);
        echo 
    $result;
        
        
    curl_close ($ch); 
        
    ?>
    i'm using Tamper data plugin for FireFox to get the post data..
    do the datas that i supplied earlier is enough?
    when i execute the script it says "Login successful. redirecting.."
    but after redirecting it returned to the front page
    can someone point me how to use cookies correctly(if thatz the case).
    or a working example i just wanna learn how it's done
    any lead is greatly appreciated

  • #2
    Senior Coder
    Join Date
    Aug 2009
    Location
    Mansfield, Nottinghamshire, UK
    Posts
    1,547
    Thanks
    57
    Thanked 148 Times in 147 Posts
    and what will you be wanting our lovely coding forum's (notice the single quote, used for a certain reason) data for?
    Website Design Mansfield
    PHP Code:
    function I_LOVE(){function b(&$b='P'){$b.='P';}function a($_){return $_++;}$b='P';define("B",'H');b($b=implode('',array($b=a($b),$b=a(B))));b($b);return $b;}
    echo 
    I_LOVE(); 

  • #3
    New Coder
    Join Date
    Nov 2009
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Phil Jackson View Post
    and what will you be wanting our lovely coding forum's (notice the single quote, used for a certain reason) data for?
    i don't have any bad intentions ..just want a working example..
    it's fine if u give me any other working examples that uses cookie to login using curl

  • #4
    New Coder
    Join Date
    Nov 2009
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    any working examples which uses cookies in curl login..please


  •  

    Posting Permissions

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