[req] Ubuntu 11.04 PHP Curl Cookie Problems

Status
Not open for further replies.

heppinnz

Active Member
94
2010
2
0
Hi dears coders. I have a problem with PHP CURL Cookie... i am writed script and he work fine on home pc (windows 7), but when i load this script to my server (ubuntu 11.04) he did not work... cookie.txt file do not writed...

Please Help!

ps: sorry for my bad english...
 
8 comments
If i am not wrong, it is a auto bot.

chmod these folders with all files inside to 777

cookies
download
mtn
rar
logs.txt


and if any other folder or files
 
nope... i am writed info grabber from one site ... all you say I did it... but it is does not help anyway... very strange ...
 
PHP:
function getCookie($user, $pass) {
        $ch = curl_init();
        curl_setopt_array($ch, array(
            CURLOPT_URL => 'http://blahblahblah.com/login.php',
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_COOKIEJAR => 'cookie.txt',
            CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 5.1; rv:6.0.2) Gecko/20100101 Firefox/6.0.2',
            CURLOPT_POST => true,
            CURLOPT_POSTFIELDS => "user=$user&password=$pass"
        ));
        curl_exec($ch);
        curl_close($ch);
    }
 
Execute this code to check if the dir is writable:
PHP:
<?php
if (is_writable(dirname(__FILE__)) echo "Good"
else echo "Bad";
?>

If it shows "good" then try this code and see if it works:

PHP:
function getCookie($user, $pass) {
        $ch = curl_init();
        curl_setopt_array($ch, array(
            CURLOPT_URL => 'http://blahblahblah.com/login.php',
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_COOKIEJAR => realpath('cookie.txt'),
            CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 5.1; rv:6.0.2) Gecko/20100101 Firefox/6.0.2',
            CURLOPT_POST => true,
            CURLOPT_POSTFIELDS => "user=$user&password=$pass"
        ));
        curl_exec($ch);
        curl_close($ch);
    }

Get the realpath of the file by using realpath function - </span></span>realpath('cookie.txt')
 
Status
Not open for further replies.
Back
Top