PHP Classes

File: get_using_cookie.php

Recommend this page to a friend!
  Classes of Schroetter Christian   PHP Curl HTTP Wrapper   get_using_cookie.php   Download  
File: get_using_cookie.php
Role: Example script
Content type: text/plain
Description: Sample file
Class: PHP Curl HTTP Wrapper
Send HTTP requests with Curl and cache the results
Author: By
Last change:
Date: 9 years ago
Size: 973 bytes


Class file image Download

$curl = new CCurlWrapper();
$curl->InitEx() === false)
'Unable to init the CURL library' . "\n");

$mag_num = 159;

// request
$content_no_cookie = $curl->Exec('' . $mag_num);

// cookie's JAR
// use new cookie for every request (the content of the 'cookie.txt' is ignore)

$curl->SetCookie(array('AuchanEM=||||||', '' . $mag_num . '||'));
$content_cookie = $curl->Exec('' . $mag_num);

// file_put_contents('./content_no_cookie.html', $content_no_cookie);
    // file_put_contents('./content_cookie.html', $content_cookie);

    // the difference is top left
        // "TROUVEZ MON MAGASIN" (Find my store) without cookie
        // "MON MAGASIN : GRASSE(changer)" (My store : GRASSE(change) with cookie