1: <?php
2:
3: /**
4: * A RESTian_Http_Agent represents the internal type of agent that calls HTTP:
5: *
6: * 'wordpress' for WordPress wp_remote_get()
7: * 'php_curl' for PHP's CURL
8: *
9: * Having more than one agent allows RESTian to be used outside WordPress.
10: *
11: */
12: abstract class RESTian_Http_Agent_Base {
13: var $agent_type;
14: var $error_num = false;
15: var $error_msg = false;
16:
17: /**
18: * @param $agent_type
19: */
20: function __construct( $agent_type ) {
21: $this->agent_type = $agent_type;
22: }
23:
24: /**
25: * Provides a generic HTTP GET method that can call WordPress' wp_remove_get() if available, or CURL if not.
26: *
27: * @param RESTian_Request $request
28: * @param RESTian_Response $response
29: * @return RESTian_Response
30: * @throws Exception
31: */
32: function make_request( $request, $response ) {
33: if (1) // Only here so PhpStorm won't flag as an error
34: throw new Exception( 'Class ' . get_class($this) . ' [subclass of ' . __CLASS__ . '] must define $this->make_request().' );
35: return $response;
36: }
37:
38: }
39:
40: