Skip to content

Instantly share code, notes, and snippets.

@elzup
Created January 1, 2015 02:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elzup/f0c5c8614458b85d0710 to your computer and use it in GitHub Desktop.
Save elzup/f0c5c8614458b85d0710 to your computer and use it in GitHub Desktop.
<?php
/*
* TwitterAPI1.1 url snippets 生成
*/
require_once('./simple_html_dom.php');
/*【保存版】TwitterAPI1.1 REST API 全項目解説 | DX.univ */
$url = 'http://dx.24-7.co.jp/twitterapi1-1-rest-api/';
$html = file_get_html($url);
foreach ($html->find('tr') as $tr) {
if (!$tr->find('td', 0) || !($tr->find('td', 0)->find('a'))) {
continue;
}
list($td1, $td_disc) = $tr->find('td');
list($method, $query_base) = explode(' ', $td1->find('a', 0)->innertext);
$query = $query_base;
$discription = $td_disc->innertext;
echo <<<EOF
snippet $query
abbr $discription
options word
$query_base\n\n
EOF;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment