Beginning to work on the client-side sample.
This commit is contained in:
parent
e5a085ff48
commit
66be033022
|
|
@ -161,6 +161,21 @@ class Request {
|
|||
return $this->uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the method for the request.
|
||||
*
|
||||
* @param string $method
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function setMethod($method) {
|
||||
|
||||
if (!is_string($method)) {
|
||||
throw new \InvalidArgumentException('method must be a string.');
|
||||
}
|
||||
|
||||
$this->method = $method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the path and pathParts members.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Client-side Request and Response
|
||||
*
|
||||
* This script will build a request to an external server, issue the request,
|
||||
* then read the reponse returned by the server.
|
||||
*/
|
||||
|
||||
// Include the Well RESTed Request and Response class files.
|
||||
require_once('../Request.inc.php');
|
||||
require_once('../Response.inc.php');
|
||||
|
||||
// Create a new empty request.
|
||||
$rqst = new \wellrested\Request();
|
||||
|
||||
// Set some of the information for it.
|
||||
$rqst->path = 'https://www.google.com/search';
|
||||
$rqst->query = array('q' => 'rest api');
|
||||
|
||||
print $rqst->uri;
|
||||
|
||||
|
||||
?>
|
||||
Loading…
Reference in New Issue