Komut satırı cURL çalışıyor ama php biri değil

0 Cevap php

Kodu:

// That works pretty well
curl -d "user%5Blogin%5D=some%40email.pl&user%5Bpass%5D=testpass&user%5Bmemory%5D=on&user%5Bsubmit%5D=Login" -L -c cookie.txt http://turbobit.net/user/login


//But this PHP code doesn't

$headers = array('Content-Type' => 'application/x-www-form-urlencoded', 'Referer' => 'http://turbobit.net/');
    $postdata = array('user%5Blogin%5D' => 'some%40email.pl', 'user%5Bpass%5D' => 'test', "user%5Bsubmit%5D" => 'Login', 'user%5Bmemory%5D' => 'on');
    $cookie = "/srv/http/test/regexturbobit/cookie.txt";

    $c = curl_init('http://tutbobit.net/user/login');
    curl_setopt ($c, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
    curl_setopt($c, CURLOPT_POST, 1);
    curl_setopt ($c, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($c, CURLOPT_FOLLOWLOCATION,1);
    curl_setopt($c, CURLOPT_POSTFIELDS, $postdata);
    curl_setopt ($c, CURLOPT_COOKIEJAR, $cookie);
    $output=curl_exec($c);
    curl_close($c);
    print_r($output);

sadece bir şey göstermek ve hatta çerez kaydetmek yok değil ...

0 Cevap