Skip to content

Instantly share code, notes, and snippets.

View crismanNoble's full-sized avatar

Cris Noble crismanNoble

View GitHub Profile
@jamalsa
jamalsa / gist:660704
Created November 3, 2010 02:14
Use YQL to get title and description from website
<?php
// Set root url, which point to yahoo api
$root = 'http://query.yahooapis.com/v1/public/yql?format=json&diagnostics=true&callback=cbfunc';
// Get title from google
$titleUrl = $root . '&q=' . urlencode("select content from html where url = 'http://google.com' and xpath = '//title'");
// Get description from google
$descUrl = $root . '&q=' . urlencode("select content from html where url='http://google.com' and xpath = '//meta' and name='description'");
// Process it