Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

http-requester

Allows one to send http GET, PUT, POST, DELETE request and view response

Information

There are 2 instance variables (which can be set from the constructor for simplicity): $verbose, and $printResults. See javadoc of the contructor for info about them

It has 4 public methods: get, put, post, delete. Each makes an http request and (depending on your setting) returns or prints the result in the form ["statusCode" => statusNum, "response" => response]

Examples

Note: In the following examples, http result = ["statusCode" => statusNum, "response" => response] and http info is http headers and such. Can substitute get for put, post, delete. All work the same way

$http = new SendHTTP(); // optional two params, verbose and printResults described below

To only return http results without fluff of printing any other info
$http->get('http://example/com', ['key1' => 'value1', 'key2' => 'value2']);

To print http info to screen, but return http results
$http->verbose = true;
$http->get('http://example/com', ['key1' => 'value1', 'key2' => 'value2']);

To print http info and http results
$http->verbose = true;
$http->printResults = true;
$http->get('http://example/com', ['key1' => 'value1', 'key2' => 'value2']);

The 2nd parameter is optional, so one can also do
$http->get('http://example/com');

About

Allows one to send http GET, PUT, POST, DELETE request and view response

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages