1. Go to this page and download the library: Download comodojo/httprequest library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
comodojo / httprequest example snippets
try {
// create an instance of Httprequest
$http = new \Comodojo\Httprequest\Httprequest("www.example.com");
// or:
// $http = new \Comodojo\Httprequest\Httprequest();
// $http->setHost("www.example.com");
// get remote data
$result = $http->get();
} catch (\Comodojo\Exception\HttpException $he) {
/* handle http specific exception */
} catch (\Exception $e) {
/* handle generic exception */
}
$data = array('foo'=>'bar', 'baz'=>'boom');
try {
// create an instance of Httprequest
$http = new \Comodojo\Httprequest\Httprequest("www.example.com");
// get remote data
$result = $http->setHttpMethod("POST")->send($data);
} catch (\Comodojo\Exception\HttpException $he) {
/* handle http specific exception */
} catch (\Exception $e) {
/* handle generic exception */
}