Skip to content

bsacks99/SimpleRestClient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Simple PHP Rest Client

  • Supports Basic Authentication only
  • Provides simple syntax
  • Supports POST, PUT, DELETE, and GET

    Easy examples:

    require_once ('cRestClient.php');
    

    $headers = array('Accept' => 'application/json', 'Content-Type' => 'application/json'); $user = 'test'; $pass = 'test';

    $c = new cRestClient($user, $pass, $headers);

    $response = $c->get('http://requestb.in/sbqw6ksb');

    require_once ('cRestClient.php');
    
    $headers = array('Accept' => 'application/json', 'Content-Type' => 'application/json');
    $user = 'test';
    $pass = 'test';
    
    $c = new cRestClient($user, $pass, $headers);
    
    $response = $c->post('http://requestb.in/sbqw6ksb', '{"json":true}'); 
    

    More complex example:

    require_once ('cRestClient.php');
    

    $user = 'test'; $pass = 'test';

    $c = new cRestClient(); $c->addHeader('Accept', 'application/json'); $c->addHeader('Content-Type', 'application/json');

    $c->setMethod('POST'); $c->setBasicAuth($user, $pass); $c->setVerbose(true);

    $c->setPayload('{"json": true}');

    $c->setUrl('http://requestb.in/sbqw6ksb');

    $c->go();

    $response = $c->get('http://requestb.in/sbqw6ksb');

  • About

    No description, website, or topics provided.

    Resources

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published

    Languages