Simplified samples.
This commit is contained in:
parent
bb44b27787
commit
85e51bbca9
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This is the file that is requested by client-set-request-and-response.php
|
||||
*
|
||||
* Feel free to modify this script, then run client-set-request-and-response.php
|
||||
* to see the results.
|
||||
*/
|
||||
|
||||
require_once('../Response.inc.php');
|
||||
|
||||
// Create a new Response instance.
|
||||
$resp = new \wellrested\Response();
|
||||
$resp->statusCode = 200;
|
||||
$resp->setHeader('Content-Type', 'text/plain');
|
||||
$resp->setHeader('User-Agent', 'Well RESTed');
|
||||
$resp->body = 'The test works!';
|
||||
$resp->respond();
|
||||
exit;
|
||||
|
||||
?>
|
||||
|
|
@ -18,7 +18,7 @@ $rqst = new \wellrested\Request();
|
|||
|
||||
// Use the client-site-endpoint.php script
|
||||
$rqst->hostname = $_SERVER['HTTP_HOST'];
|
||||
$rqst->path = '/wellrested/samples/client-side-endpoint.php';
|
||||
$rqst->path = '/wellrested/samples/server-side-response.php';
|
||||
|
||||
// Issue the request, and read the response returned by the server.
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Create and output a response from the server.
|
||||
*/
|
||||
|
||||
require_once('../Response.inc.php');
|
||||
|
||||
// Create a new Response instance.
|
||||
$resp = new \wellrested\Response();
|
||||
$resp->statusCode = 200;
|
||||
$resp->setHeader('Content-Type', 'text/plain');
|
||||
$resp->body = 'This is a response.';
|
||||
$resp->respond();
|
||||
exit;
|
||||
|
||||
?>
|
||||
Loading…
Reference in New Issue