Skip to content

Commit

Permalink
Added Request_Cookie_Jar example
Browse files Browse the repository at this point in the history
  • Loading branch information
catharsisjelly committed May 5, 2015
1 parent 819c545 commit 88a4cad
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions examples/cookie_jar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

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

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

// Say you need to fake a login cookie
$c = new Requests_Cookie_Jar(['login_uid' => 'something']);

// Now let's make a request!
$request = Requests::get(
'http://httpbin.org/cookies', //url
[], // No need to set the headers the Jar does this for us
['cookies' => $c] // Pass in the Jar as an option
);

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

0 comments on commit 88a4cad

Please sign in to comment.