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 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jun 2009
    Posts
    351
    Thanks
    75
    Thanked 0 Times in 0 Posts

    php curl help please

    I have the following code but i can seem to log into the page can somebody tell me what is wrong please

    PHP Code:
    <?php
    error_reporting
    (E_ALL);
    $maindir dirname(__FILE__) . DIRECTORY_SEPARATOR;
    include(
    $maindir.'functions.php');

    set_time_limit(0);
    ini_set('memory_limit','128M');

    $curl_handle curl_init();
    define("SSL_CA_FILE"".\\temp\\ssl");
    define("COOKIE_FILE""cookies.txt");

    $source_file $maindir.'login_info.txt';
        
    // report errores
    error_reporting(-1);
        
        
    $maindir.'login_info.txt';
        
    $fp_s fopen($source_file'r');
            
        
    $ch curl_init();

      
    //curl_followlocation set the curl to follow the site and get the final web page if the
      // website has redirects

        
    curl_setopt($chCURLOPT_FOLLOWLOCATIONtrue);
        
    curl_setopt($chCURLOPT_USERAGENT'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322)');
                    
        
    // save cookie
        
    curl_setopt($chCURLOPT_COOKIEJAR$maindir.'cookie.txt');

        
    // get cookie
        
    curl_setopt($chCURLOPT_COOKIEFILE$maindir.'cookie.txt');    

        
    // not to print out the results
        
    curl_setopt($chCURLOPT_RETURNTRANSFER1);
        
        
    curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);


        
            
    $account  '42775990';
            
    $password 'kevinkhan';
        
            
            if(
    file_exists(COOKIE_FILE)) {
                
    unlink(COOKIE_FILE);
                }
                

            
    $qryString 'email='.urlencode($account).'&pass='.urlencode($password).'&login_type=1';
            
            
    curl_setopt($chCURLOPT_POSTtrue);
            
    curl_setopt($chCURLOPT_POSTFIELDS$qryString);
            
            
    curl_setopt($chCURLOPT_URL'https://secure.gumtree.ie/account/login');
            
            
    $page curl_exec($ch);
            echo 
    $page;



        
    // close session
        
    curl_close($ch);
        
    ?>

  • #2
    Regular Coder
    Join Date
    Jun 2009
    Posts
    351
    Thanks
    75
    Thanked 0 Times in 0 Posts
    i want to get two this page
    Attached Thumbnails Attached Thumbnails php curl help please-gumtree.jpg  


  •  

    Posting Permissions

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