function ping($data){ $server_url = array( 'baidu' => 'http://ping.baidu.com/ping/RPC2', // 'google' => 'http://blogsearch.google.com/ping/RPC2', //'bloglines' => 'http://www.bloglines.com/ping' ); $xml = ' weblogUpdates.extendedPing ' . $data['blog_name'] . ' ' . $data['blog_home'] . ' ' . $data['blog_url'] . ' ' . $data['rss_url'] . ' ' $xml_baidu = ' weblogUpdates.extendedPing ' . $data['blog_name'] . ' ' . $data['blog_home'] . ' ' . $data['blog_url'] . ' ' . $data['rss_url'] . ' ' foreach ($server_url as $k => $s){ $s = trim($s); if(!empty($s)){ $c = curl_init(); $header = array( "Content-type: text/xml;charset="utf-8"", "Accept: text/xml" ); curl_setopt _array( $c, array( CURLOPT_URL => $s, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => $header, CURLOPT_POSTFIELDS => $k === 'baidu' ? $xml_baidu : $xml ) ); $content=curl_exec($c); var_dump($content); curl_close($c); } } }