basic-auth.php 392 B

12345678910111213141516
  1. <?php
  2. // First, include Requests
  3. include('../library/Requests.php');
  4. // Next, make sure Requests can load internal classes
  5. Requests::register_autoloader();
  6. // Now let's make a request!
  7. $options = array(
  8. 'auth' => array('someuser', 'password')
  9. );
  10. $request = Requests::get('http://httpbin.org/basic-auth/someuser/password', array(), $options);
  11. // Check what we received
  12. var_dump($request);