Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
58% | Total: 178 | All time: 8,739 This week: 455 |
Version | License | PHP version | Categories | |||
hcurl 1.0 | MIT/X Consortium ... | 5.0 | HTTP, PHP 5 |
Description | Author | |
This class can send HTTP requests using the Curl extension. |
// 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']);
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
0% |
|
|
User Ratings | ||||||||||||||||||||||||||||||
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.