Skip to content

Commit

Permalink
Add example files.
Browse files Browse the repository at this point in the history
  • Loading branch information
rmccue committed Feb 7, 2012
1 parent 6612e07 commit 4c84b02
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
16 changes: 16 additions & 0 deletions examples/basic-auth.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

// First, include Requests
include('../library/Requests.php');

// Next, make sure Requests can load internal classes
Requests::register_autoloader();

// Now let's make a request!
$options = array(
'auth' => array('someuser', 'password')
);
$request = Requests::get('http://httpbin.org/basic-auth/someuser/password', array(), $options);

// Check what we received
var_dump($request);
13 changes: 13 additions & 0 deletions examples/get.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

// First, include Requests
include('../library/Requests.php');

// Next, make sure Requests can load internal classes
Requests::register_autoloader();

// Now let's make a request!
$request = Requests::get('http://httpbin.org/get', array('Accept' => 'application/json'));

// Check what we received
var_dump($request);
13 changes: 13 additions & 0 deletions examples/post.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

// First, include Requests
include('../library/Requests.php');

// Next, make sure Requests can load internal classes
Requests::register_autoloader();

// Now let's make a request!
$request = Requests::post('http://httpbin.org/post', array(), array('mydata' => 'something'));

// Check what we received
var_dump($request);

0 comments on commit 4c84b02

Please sign in to comment.