mirror of https://gitee.com/zorlan/skycaiji
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
549 B
25 lines
549 B
<?php
|
|
|
|
// First, include Requests
|
|
include('../library/Requests.php');
|
|
|
|
// Next, make sure Requests can load internal classes
|
|
Requests::register_autoloader();
|
|
|
|
// Set up our session
|
|
$session = new Requests_Session('http://httpbin.org/');
|
|
$session->headers['Accept'] = 'application/json';
|
|
$session->useragent = 'Awesomesauce';
|
|
|
|
// Now let's make a request!
|
|
$request = $session->get('/get');
|
|
|
|
// Check what we received
|
|
var_dump($request);
|
|
|
|
// Let's check our user agent!
|
|
$request = $session->get('/user-agent');
|
|
|
|
// And check again
|
|
var_dump($request);
|