Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #124 from catharsisjelly/master

Added example on how to use Cookie
  • Loading branch information...
commit aa2168ed0f625ea191e9b0c37c7a43e513e7b53a 2 parents 9822168 + 819c545
@rmccue authored
Showing with 16 additions and 0 deletions.
  1. +16 −0 examples/cookie.php
View
16 examples/cookie.php
@@ -0,0 +1,16 @@
+<?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('login_uid', 'something');
+
+// Now let's make a request!
+$request = Requests::get('http://httpbin.org/cookies', array('Cookie' => $c->formatForHeader()));
+
+// Check what we received
+var_dump($request);
Please sign in to comment.
Something went wrong with that request. Please try again.