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.
skycaiji/vendor/rmccue/requests/examples/timeout.php

18 lines
458 B

<?php
// First, include Requests
include('../library/Requests.php');
// Next, make sure Requests can load internal classes
Requests::register_autoloader();
// Define a timeout of 2.5 seconds
$options = array(
'timeout' => 2.5,
);
// Now let's make a request to a page that will delay its response by 3 seconds
$request = Requests::get('http://httpbin.org/delay/3', array(), $options);
// An exception will be thrown, stating a timeout of the request !