百度ping接口 百度ping方法
class ping{ private $title; //博客名称 private $hosturl; //博客首页地址 private $arturl; //新发文章地址 private $rssurl; //博客rss地址 private $baiduXML; //百度XML结构 private $baiduRPC; //百度XML地址 public function __construct($title,$arturl,$hosturl,$rssurl) { if(empty($title) || empty($arturl)) return false; $this->title=$title; $this->hosturl=$hosturl; $this->rssurl=$rssurl; $this->arturl=$arturl; $this->baiduRPC='http://ping.baidu.com/ping/RPC2'; $this->baiduXML = ''; $this->baiduXML .=''; $this->baiduXML .=' weblogUpdates.extendedPing'; $this->baiduXML .=' '; $this->baiduXML .=' '.$this->hosturl.''; $this->baiduXML .=' '.$this->title.''; $this->baiduXML .=' '.$this->arturl.''; $this->baiduXML .=' '.$this->rssurl.''; $this->baiduXML .=' '; $this->baiduXML .=''; } public function pingbaidu() { $ch = curl_init(); $headers=array( 'User-Agent: request', 'Host: ping.baidu.com', 'Content-Type: text/xml', ); curl_setopt($ch, CURLOPT_URL, $this->baiduRPC); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POSTFIELDS, $this->baiduXML); $res = curl_exec ($ch); curl_close ($ch); //return $res; return (strpos($res,"0"))?true:false; } } function get_domain() { /* 协议 */ $protocol = 'http://'; /* 域名或IP地址 */ if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) { $host = $_SERVER['HTTP_X_FORWARDED_HOST']; } elseif (isset($_SERVER['HTTP_HOST'])) { $host = $_SERVER['HTTP_HOST']; } else { /* 端口 */ if (isset($_SERVER['SERVER_PORT'])) { $port = ':' . $_SERVER['SERVER_PORT']; if ((':80' == $port & 'http://' == $protocol) || (':443' == $port & 'https://' == $protocol)) { $port = ''; } } else { $port = ''; } if (isset($_SERVER['SERVER_NAME'])) { $host = $_SERVER['SERVER_NAME'] . $port; } elseif (isset($_SERVER['SERVER_ADDR'])) { $host = $_SERVER['SERVER_ADDR'] . $port; } } return $protocol.$host; } //$arc = new Ping('网站标题','更新的URL地址','网站域名','rss地址'); //$arc = new Ping('你网站的title',get_arcurl($id),get_domain(),'http://www.abc.com/rss.php'); //echo $arc->pingbaidu(); //返回结果为0 表示成功。
로그인 후 복사
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사
R.E.P.O. 에너지 결정과 그들이하는 일 (노란색 크리스탈)
2 몇 주 전
By 尊渡假赌尊渡假赌尊渡假赌
스플릿 소설을이기는 데 얼마나 걸립니까?
1 몇 달 전
By DDD
R.E.P.O. 최고의 그래픽 설정
2 몇 주 전
By 尊渡假赌尊渡假赌尊渡假赌
어 ass 신 크리드 그림자 : 조개 수수께끼 솔루션
1 몇 주 전
By DDD
R.E.P.O. 아무도들을 수없는 경우 오디오를 수정하는 방법
2 몇 주 전
By 尊渡假赌尊渡假赌尊渡假赌

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제
Gmail 이메일의 로그인 입구는 어디에 있나요?
7403
15


자바 튜토리얼
1630
14


Cakephp 튜토리얼
1358
52


라라벨 튜토리얼
1268
25


PHP 튜토리얼
1218
29

