Skip to content

A set of wrapper classes to make http request easier using php curl

Notifications You must be signed in to change notification settings

marjune163/php-http-agent

Repository files navigation

Quick Start

Get Content

$http = new HttpGetAgent('http://www.example.com?a=1');
$http->addGetParameter('b', 2);
$http->addGetParameter('c', 3);
$result = $http->request();
//this will get content from http://www.example.com?a=1&b=2&c=3

Post Content like a form

$http = new HttpPostFormAgent('http://www.example.com/contact');
$http->setRequestHeader('Referer', 'http://www.example.com');
$http->addPostParameter('name', 'foo');
$http->addPostParameter('tel', 'bar');
$http->addPostParameter('email', '[email protected]');
$http->addPostParameter('message', 'Lorem ipsum dolor sit amet, ...');
$result = $http->request();

Post JSON content

$http = new HttpPostJsonAgent('http://www.example.com/submit_json);
$http->postData=array('a'=>1, 'b'=>2);
$result = $http->request();

About

A set of wrapper classes to make http request easier using php curl

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages