PHP Classes

Horus Curl: Send HTTP requests using the Curl extension

Recommend this page to a friend!
  Info   View files Documentation   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 58%Total: 178 This week: 1All time: 8,733 This week: 560Up
Version License PHP version Categories
hcurl 1.0MIT/X Consortium ...5.0HTTP, PHP 5
Description 

Author

This class can send HTTP requests using the Curl extension.

It can send HTTP GET or POST requests to a given URL.

The class sets several Curl default options but they can be overriden passing an array of option values.

It can follow HTTP redirect responses, as well follow redirects defined in HTML meta tags.

Picture of Mohammed Al Ashaal
  Performance   Level  
Name: Mohammed Al Ashaal <contact>
Classes: 8 packages by
Country: Egypt Egypt
Age: 30
All time rank: 128111 in Egypt Egypt
Week rank: 416 Up8 in Egypt Egypt Up
Innovation award
Innovation award
Nominee: 2x

Winner: 1x

Documentation


// load it
require 'HCurl.php';

// start it
$curl = new HCurl;

// manage google
$google = $curl->on('google.com');

// set some options
// i'll make it [follow locations]
// i have extended curl to follow html-meta redirects
// not only http and also can follow redirects under
// safe mode [on] !
$google->options(array
(
    CURLOPT_FOLLOWLOCATION => TRUE
));

// change the useragent
// Available {
//      HCurl::CHROME
//      HCurl::FIREFOX
//      HCurl::OPERA
//      HCurl::SAFARI
//      HCurl::IE
//      HCurl::Horus
// }
$google->useragent(HCurl::CHROME);

// send haders
$google->headers(array(
    'HEADER-KEY: Value',
    'HEADER-New-Key: New Value'
));

// do a get request
var_dump($google->get());
// do a post request and post data are 'keywords=xxx&k2=v2'
var_dump($google->post(array('keywords' => 'xx', 'k2' => 'v2')));
// do a put request and post data are 'keywords=xxx&k2=v2'
var_dump($google->put(array('keywords' => 'xx', 'k2' => 'v2')));
// do a yyy request and post data are 'keywords=xxx&k2=v2'
var_dump($google->yyy(array('keywords' => 'xx', 'k2' => 'v2')));

// any request will return an array contains
// 'headers' and 'body'
// example:
$google = $google->get();

// headers array
var_dump($google['headers']);

// body string
var_dump($google['body']);


  Files folder image Files  
File Role Description
Plain text file HCurl.php Class Horus Curl Class
Accessible without login Plain text file README.md Doc. How to use

 Version Control Unique User Downloads Download Rankings  
 0%
Total:178
This week:1
All time:8,733
This week:560Up
 User Ratings  
 
 All time
Utility:87%StarStarStarStarStar
Consistency:81%StarStarStarStarStar
Documentation:62%StarStarStarStar
Examples:-
Tests:-
Videos:-
Overall:58%StarStarStar
Rank:1538