1*a1a3b679SAndreas Boehler<?php 2*a1a3b679SAndreas Boehler 3*a1a3b679SAndreas Boehler/** 4*a1a3b679SAndreas Boehler * This example shows how to make a HTTP request with the Request and Response 5*a1a3b679SAndreas Boehler * objects. 6*a1a3b679SAndreas Boehler * 7*a1a3b679SAndreas Boehler * @copyright Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/). 8*a1a3b679SAndreas Boehler * @author Evert Pot (http://evertpot.com/) 9*a1a3b679SAndreas Boehler * @license http://sabre.io/license/ Modified BSD License 10*a1a3b679SAndreas Boehler */ 11*a1a3b679SAndreas Boehleruse Sabre\HTTP\Request; 12*a1a3b679SAndreas Boehleruse Sabre\HTTP\Client; 13*a1a3b679SAndreas Boehler 14*a1a3b679SAndreas Boehler// Find the autoloader 15*a1a3b679SAndreas Boehler$paths = [ 16*a1a3b679SAndreas Boehler __DIR__ . '/../vendor/autoload.php', 17*a1a3b679SAndreas Boehler __DIR__ . '/../../../autoload.php', 18*a1a3b679SAndreas Boehler __DIR__ . '/vendor/autoload.php', 19*a1a3b679SAndreas Boehler 20*a1a3b679SAndreas Boehler]; 21*a1a3b679SAndreas Boehler 22*a1a3b679SAndreas Boehlerforeach ($paths as $path) { 23*a1a3b679SAndreas Boehler if (file_exists($path)) { 24*a1a3b679SAndreas Boehler include $path; 25*a1a3b679SAndreas Boehler break; 26*a1a3b679SAndreas Boehler } 27*a1a3b679SAndreas Boehler} 28*a1a3b679SAndreas Boehler 29*a1a3b679SAndreas Boehler// Constructing the request. 30*a1a3b679SAndreas Boehler$request = new Request('GET', 'http://localhost/'); 31*a1a3b679SAndreas Boehler 32*a1a3b679SAndreas Boehler$client = new Client(); 33*a1a3b679SAndreas Boehler//$client->addCurlSetting(CURLOPT_PROXY,'localhost:8888'); 34*a1a3b679SAndreas Boehler$response = $client->send($request); 35*a1a3b679SAndreas Boehler 36*a1a3b679SAndreas Boehlerecho "Response:\n"; 37*a1a3b679SAndreas Boehler 38*a1a3b679SAndreas Boehlerecho (string)$response; 39