src/tools/web/PingBack.php
function inspect($source) {
		$fw=Base::instance();
		$web=Web::instance();
		$parts=parse_url($source);
		if (empty($parts['scheme']) || empty($parts['host']) ||
			$parts['host']==$fw->get('HOST')) {
			$req=$web->request($source);
			$doc=new DOMDocument('1.0',$fw->get('ENCODING'));
			$doc->stricterrorchecking=FALSE;
			$doc->recover=TRUE;
			if ($req && @$doc->loadhtml($req['body'])) {
				// Parse anchor tags
				$links=$doc->getelementsbytagname('a');
				foreach ($links as $link) {
					$permalink=$link->getattribute('href');
					// Find pingback-enabled resources
					if ($permalink && $found=$this->enabled($permalink)) {
						$req=$web->request($found,
							array(
								'method'=>'POST',
								'header'=>'Content-Type: application/xml',
								'content'=>xmlrpc_encode_request(
									'pingback.ping',
									array($source,$permalink),
									array('encoding'=>$fw->get('ENCODING'))
								)
							)
						);
						if ($req && $req['body'])
							$this->log.=date('r').' '.
								$permalink.' [permalink:'.$found.']'.PHP_EOL.
								$req['body'].PHP_EOL;
					}
				}
			}
			unset($doc);
		}
	}
function inspect($source) {
		$fw=Base::instance();
		$web=Web::instance();
		$parts=parse_url($source);
		if (empty($parts['scheme']) || empty($parts['host']) ||
			$parts['host']==$fw->get('HOST')) {
			$req=$web->request($source);
			$doc=new DOMDocument('1.0',$fw->get('ENCODING'));
			$doc->stricterrorchecking=FALSE;
			$doc->recover=TRUE;
			if ($req && @$doc->loadhtml($req['body'])) {
				// Parse anchor tags
				$links=$doc->getelementsbytagname('a');
				foreach ($links as $link) {
					$permalink=$link->getattribute('href');
					// Find pingback-enabled resources
					if ($permalink && $found=$this->enabled($permalink)) {
						$req=$web->request($found,
							array(
								'method'=>'POST',
								'header'=>'Content-Type: application/xml',
								'content'=>xmlrpc_encode_request(
									'pingback.ping',
									array($source,$permalink),
									array('encoding'=>$fw->get('ENCODING'))
								)
							)
						);
						if ($req && $req['body'])
							$this->log.=date('r').' '.
								$permalink.' [permalink:'.$found.']'.PHP_EOL.
								$req['body'].PHP_EOL;
					}
				}
			}
			unset($doc);
		}
	}
function inspect ( $ source ) { $ fw = Base :: instance ( ) ; $ web = Web :: instance ( ) ; $ parts = parse_url ( $ source ) ; if ( empty ( $ parts [ 'scheme' ] ) || empty ( $ parts [ 'host' ] ) || $ parts [ 'host' ] == $ fw -> get ( 'HOST' ) ) { $ req = $ web -> request ( $ source ) ; $ doc = new DOMDocument ( '1.0' , $ fw -> get ( 'ENCODING' ) ) ; $ doc -> stricterrorchecking = FALSE ; $ doc -> recover = TRUE ; if ( $ req && @ $ doc -> loadhtml ( $ req [ 'body' ] ) ) { // Parse anchor tags $ links = $ doc -> getelementsbytagname ( 'a' ) ; foreach ( $ links as $ link ) { $ permalink = $ link -> getattribute ( 'href' ) ; // Find pingback-enabled resources if ( $ permalink && $ found = $ this -> enabled ( $ permalink ) ) { $ req = $ web -> request ( $ found , array ( 'method' => 'POST' , 'header' => 'Content-Type: application/xml' , 'content' => xmlrpc_encode_request ( 'pingback.ping' , array ( $ source , $ permalink ) , array ( 'encoding' => $ fw -> get ( 'ENCODING' ) ) ) ) ) ; if ( $ req && $ req [ 'body' ] ) $ this -> log .= date ( 'r' ) . ' ' . $ permalink . ' [permalink:' . $ found . ']' . PHP_EOL . $ req [ 'body' ] . PHP_EOL ; } } } unset ( $ doc ) ; } }
Load local page contents, parse HTML anchor tags, find permalinks,
and send XML-RPC calls to corresponding pingback servers
@return NULL
@param $source string
Load local page contents parse HTML anchor tags find permalinks and send XML - RPC calls to corresponding pingback servers