Using Zend to retrive wikipedia api content

function getWikipediaContent( $wikiUrl )


// initialize HTTP client
$client = new Zend_Http_Client();
// Set it for wikipedia
$client->setUri( $wikiUrl );
// Set url params for get request
$client->setParameterGet(‘titles’, $urlSlug);
// Get the wiki page via a get request
$result = $client->request(‘GET’);

// Make sure actual data was returned. If not, return false
if( $result->isError() )
return false;

// Put response body in to variable
$body = $result->getBody();

// Transform string in to xml feed so it can be parsed.
$wikiXml = new SimpleXMLElement( $body );
// Get body and transform back to string.
return (string) $wikiXml->query->pages->page->revisions->rev;


JS logging

I’ve been doing a fair about of js development lately and console.log has been my friend. However, writing console.log() is a bit heavy. So instead I’ve been adding this to my files as  a quick way to log in javascipt.

function log() {
if (window.console && console.log)
console.log(‘{product or sitename} ::  ‘ +,’ ‘));