public
Description: An extendable PHP library to communicate with RESTful rails applications
Homepage:
Clone URL: git://github.com/shuber/restful_rails.git
restful_rails / restful_rails_response.php
100644 26 lines (19 sloc) 0.582 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
 
// Restful Rails - Response
//
// Author: Sean Huber (shuber@huberry.com)
// Date: January 2008
//
// Type casts CurlResponse objects
 
class RestfulRailsResponse {
 
public function json($curl_response) {
return array('response' => $curl_response, 'json' => json_decode($curl_response->body));
}
 
public function text($curl_response) {
return array('response' => $curl_response, 'text' => $curl_response->body);
}
 
public function xml($curl_response) {
return array('response' => $curl_response, 'xml' => new SimpleXMLElement($curl_response->body));
}
 
}
 
?>