server_url = $url; $this->api_key = $key; $this->local_url = $local_url; } /** * PHP magic function for handling the calling of services * * @param string $name Name of function called * @param array $args Arguments passed */ public function __call($name, $args){ $postdata = array( 'key' => $this->api_key, 'url' => $this->local_url, 'version' => ANYFONT_VERSION, 'service' => $name, 'args' => serialize($args) ); if(function_exists('wp_remote_request')){ $result = wp_remote_request($this->server_url, array( 'timeout' => 20,'method' => 'POST', 'body' => array("c" => base64_encode(serialize($postdata))))); $response = is_array($result) ? unserialize(base64_decode($result['body'])) : false; if (false === $response){ $response = array('msg' => __('
An unknown HTTP error occurred.
Please contact support and include the following details:
This feature requires WordPress version 2.7 or higher. Please upgrade your WordPress.
')); } return $response; } } /** * An RPC Exception class, used for handling, surprisingly, * errors. */ class fontservException extends Exception{} ?>