Beginning to work on the client-side sample.

This commit is contained in:
PJ Dietz 2012-11-27 12:25:53 -05:00
parent e5a085ff48
commit 66be033022
2 changed files with 39 additions and 0 deletions

View File

@ -161,6 +161,21 @@ class Request {
return $this->uri; 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. * Set the path and pathParts members.
* *

View File

@ -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;
?>