All pastes #253029 Raw Edit

Keloran

public php v1 · immutable
#253029 ·published 2006-11-20 06:36 UTC
rendered paste body
function searchmashSearch($cSearch) {	$oDOM = new DomDocument();	$cURL = "http://www.searchmash.com/search/";	$cURL .= $cSearch;	$oDOM->loadHTMLFile($cURL);	$oXPath       = new DomXPath($oDOM);	$aXTitleNodes = $oXPath->query('//div[@class="web-title"]');	$aXURLNodes   = $oXPath->query('//div[@class="web-url"]');	$aXTextNodes  = $oXPath->query('//div[@class="web-snippet"]');	$iSeed = 0;	foreach ($aXTitleNodes as $aXTitleNode) {		$aReturn[$iSeed]['cTitle'] = $aXTitleNode->nodeValue;		$iSeed++;	}	$iSeed = 0;	foreach ($aXURLNodes as $aXURLNode) {		$aReturn[$iSeed]['cURL'] = $aXURLNode->getAttribute('href');		$iSeed++;	}	$iSeed = 0;	foreach ($aXTextNodes as $aXTextNode) {		$aReturn[$iSeed]['cDesc'] = $aXTextNode->nodeValue;		$iSeed++;	}	return $aReturn;}