Solar provides classes that let you make HTTP requests from web services, and send HTTP responses to clients.
Here's short example:
<?php
/**
* make a request from a web service and get a response
*/
// first, build a request object
$request = Solar::factory('Solar_Http_Request');
// ask for "?foo=bar&baz=dib" via POST, with a special header
$request->setUri('http://example.com/service.php')
->setMethod('post')
->setHeader('X-Special-Header', 'Some value')
->setContent(array('foo' => 'bar', 'baz' => 'dib'));
// make the request and get a Solar_Http_Response object
$response = $request->fetch();
// what was the response code?
if ($response->getStatusCode() == 200) {
// dump the content to the screen
Solar::dump($response->getContent());
} else {
// show the response code and text
echo htmlspecialchars($response->getStatusCode()),
": ",
htmlspecialchars($response->getStatusText());
}
?>