Login   Register  
PHP Classes
elePHPant
Icontem

File: example.class.curl.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Richard Munroe  >  cURL  >  example.class.curl.php  >  Download  
File: example.class.curl.php
Role: Example script
Content type: text/plain
Description: Simple example of use of the curl class.
Class: cURL
cURL extension wrapper access remote Web resources
Author: By
Last change:
Date: 2004-11-30 13:24
Size: 690 bytes
 

Contents

Class file image Download
<?php

include_once("class.curl.php") ;

//
// Create a new instance of the curl class and point it
// at the page to be fetched.
//

$c = new curl("http://www.csworks.com/resume/cv.shtml") ;

//
// By default, curl doesn't follow redirections and this
// page may or may not be available via redirection.
//

$c->setopt(CURLOPT_FOLLOWLOCATIONtrue) ;

//
// By default, the curl class expects to return data to
// the caller.
//

echo $c->exec() ;

//
// Check to see if there was an error and, if so, print
// the associated error message.
//

if ($theError $c->hasError())
{
  echo 
$theError ;
}
//
// Done with the cURL, so get rid of the cURL related resources.
//

$c->close() ;
?>