/** * Attempts to notify the server of targetUri that sourceUri refers to it. * * @param object Controller object */ public function pingbackUrl($sourceUri, $targetUri) { $urlData = $this->Socket->get($targetUri); $pingbackServerUri = $this->_determinePingbackUri($this->Socket->response); if (!empty($pingbackServerUri)) { $XmlRpcClient = new XmlRpcClient($pingbackServerUri); try { $Request = new XmlRpcRequest('pingback.ping', array(new XmlRpcValue($sourceUri), new XmlRpcValue($targetUri))); $result = $XmlRpcClient->call($Request); } catch (Exception $e) { // pingback server return error. we will ignore it } } }
/** * Constructor. * * Note: blogid is only needed if the blog is hosted by blogger.com, * in which case it is the unique blog id * * @param string url for the weblog you want to access * @param string username for the weblog * @param string password for the weblog * @param int blogid of the weblog */ public function __construct($url, $username, $password, $blogid = '0') { parent::__construct(new XMLRPCHTTPTransport($url)); $this->username = $username; $this->password = $password; $this->blogid = $blogid; }
/** * Send message to weblog system */ public function blogPing(&$model, $type, $serverUrl, $blogName, $blogUrl, $siteUrl = '', $rssUrl = '', $tags = array()) { $XmlRpcClient = new XmlRpcClient($serverUrl); if ($type == 'extendedPing') { try { if (is_array($tags)) { $tags = join('|', $tags); } $Request = new XmlRpcRequest('weblogUpdates.extendedPing', array(new XmlRpcValue($blogName), new XmlRpcValue($siteUrl), new XmlRpcValue($blogUrl), new XmlRpcValue($rssUrl), $tags)); $result = $XmlRpcClient->call($Request); } catch (XmlRpcResponseException $e) { // Nothing. } } else { try { $Request = new XmlRpcRequest('weblogUpdates.ping', array(new XmlRpcValue($blogName), new XmlRpcValue($blogUrl))); $result = $XmlRpcClient->call($Request); } catch (XmlRpcResponseException $e) { // Nothing. } } }
/** * Sends a weblogsUpdate.ping xmlrpc call to notifiy of changes in this blog * * @param blogInfo The BlogInfo object containing information about the blog * @return Returns true if successful or false otherwise. */ function updateNotify($blogInfo) { // if this feature is not enabled, we quit $config =& Config::getConfig(); if (!$config->getValue("xmlrpc_ping_enabled")) { return; } // get the array which contains the hosts $hosts = $config->getValue("xmlrpc_ping_hosts"); // if it is not an array, quit if (!is_array($hosts)) { return; } // if no hosts, we can quit too if (empty($hosts)) { return; } // otherwise, we continue $xmlrpcPingResult = array(); $rg =& RequestGenerator::getRequestGenerator($blogInfo); $blogLink = $rg->blogLink(); foreach ($hosts as $host) { $client = new XmlRpcClient($host); $result = $client->ping($blogInfo->getBlog(), $blogLink); //print("result = ".$result. "is Error = ".$client->isError()." message: ".$client->getErrorMessage()."<br/>"); //$xmlrpcPingResult[$result["host"] $xmlrpcPingResult = array_merge($xmlrpcPingResult, $result); } return $xmlrpcPingResult; }
/** * Invoke a method on Flickr, the response is being deserialized * into the given expected class. * * @param string method * @param mixed args[] * @param string expect * @return Object */ public function invokeExpecting($method, $args, $expect) { $arguments = $this->signArray(array_merge($args, array('method' => $method))); $res = parent::invoke($method, $arguments); $return = Unmarshaller::unmarshal($res[0], $expect); $return->setClient($this); return $return; }