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; }