- foreach ($notify as $notify_url => $type) {
- switch ($type) {
- case 'xmlrpc':
- case 'extended':
- $req = xmlrpc_encode_request('weblogUpdates.ping',
- array($profile->nickname, # site name
- common_local_url('showstream',
- array('nickname' => $profile->nickname)),
- common_local_url('shownotice',
- array('notice' => $notice->id)),
- common_local_url('userrss',
- array('nickname' => $profile->nickname)),
- $tags));
-
- $context = stream_context_create(array('http' => array('method' => "POST",
- 'header' =>
- "Content-Type: text/xml\r\n".
- "User-Agent: StatusNet/".STATUSNET_VERSION."\r\n",
- 'content' => $req)));
- $file = file_get_contents($notify_url, false, $context);
+ $request = HTTPClient::start();
+ $request->setConfig('connect_timeout', common_config('ping', 'timeout'));
+ $request->setConfig('timeout', common_config('ping', 'timeout'));
+ try {
+ $httpResponse = $request->post($notify_url, array('Content-Type: text/xml'), $req);
+ } catch (Exception $e) {
+ common_log(LOG_ERR,
+ "Exception pinging $notify_url: " . $e->getMessage());
+ continue;
+ }