Esempio n. 1
0
<?php

require_once "../src/curl.php";
$session = new curl();
$m1 = new curl_request();
$m1->set_url("http://www.youtube.com/");
$session->run($m1, function ($r1) use(&$session, &$m1) {
    print "[youtube] Loaded home page.\n";
    for ($i = 1; $i <= 5; ++$i) {
        $m1->set_url("http://www.youtube.com/videos?p=" . $i);
        $session->run($m1, function ($r1) use($i) {
            print "[youtube] Loaded video page {$i} ({$r1->status_code}).\n";
        });
    }
});
while (true) {
    $session->update();
    echo ".";
    // debug
    usleep(20000);
}
Esempio n. 2
0
<?php

require_once "../src/curl.php";
$session = new curl();
$m1 = new curl_request();
$m1->set_url("http://google.com/");
$r1 = $session->run($m1);
// returns a curl_response object
echo $r1->status_code;
Esempio n. 3
0
<?php

require_once 'class.curl.php';
$u = 'https://www.youtube.com/';
$c = new curl($u);
$c->ua('android');
$c->header(array("accept-encoding: gzip, deflate, sdch", "accept-language: en-US,en;q=0.8,vi;q=0.6", "x-chrome-uma-enabled: 1", "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "cache-control: max-age=0", "authority: www.youtube.com"));
$c->post($postfields);
echo $c->run();