PHP Classes
elePHPant
Icontem

File: get_cached.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Schroetter Christian  >  PHP Curl HTTP Wrapper  >  get_cached.php  >  Download  
File: get_cached.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: 1 year ago
Size: 567 bytes
 

Contents

Class file image Download
<?php
   
include('./curl.wrapper.php');

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

   
// cache per month (the folder SHOULD have been created first)
   
$curl->EnableCache(true, CACHE_MONTH, './cache');

   
// define the port (useless until it 80 but for the example...)
   
$curl->SetPort(80);

   
// the result of the request is displayed in the console if the '-v' param is supplied...
   
$curl->SetReturnTransfer(!in_array('-v', $argv));

   
// request
   
$curl->Exec('http://fr.wikipedia.org/wiki/User-Agent');

?>