Skip to content
This repository was archived by the owner on Oct 1, 2021. It is now read-only.

bradsacks99/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

    Simple PHP rest client (old)

    Resources

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published

    Languages