Beispiel #1
0
    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiename);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    // RETURN HTTP HEADERS
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    // RETURN THE CONTENTS OF THE CALL
    $data = curl_exec($ch);
    if (curl_errno($ch)) {
        echo 'cURL error: ' . curl_error($ch);
    }
    curl_close($ch);
} else {
    // RATE
    define('POSTURL', "http://www.csfd.cz/film/{$id}/?do=ratingForm-submit");
    define('POSTVARS', "rating={$finalrating}&_token_={$token}");
    $cookiename = getCookieFile($user);
    $ch = curl_init(POSTURL);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, POSTVARS);
    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiename);
    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiename);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    // RETURN HTTP HEADERS
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    // RETURN THE CONTENTS OF THE CALL
    $data = curl_exec($ch);
    if (curl_errno($ch)) {
        echo 'cURL error: ' . curl_error($ch);
    }
    curl_close($ch);
Beispiel #2
0
function getCurl($url, $cookies, $user, $header = 0)
{
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_COOKIE, $cookies);
    $sessionid = $_GET['sessionid'];
    $cookiename = getCookieFile($user);
    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiename);
    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiename);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_HEADER, $header);
    // RETURN HTTP HEADERS
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    // RETURN THE CONTENTS OF THE CALL
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
}