Created
July 14, 2013 08:58
-
-
Save Leko/5993679 to your computer and use it in GitHub Desktop.
Markdown Link Generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('workflows.php'); | |
$wf = new Workflows(); | |
$url = "{query}"; | |
// htmlを取得してtitleタグを抜き出し | |
$html = $wf->request($url); | |
preg_match("/<title>(.*?)<\/title>/i", $html, $match); | |
// マッチしたタイトルを取得しMarkdownのリンク形式に | |
$title = $match[1]; | |
$md = "[".$title."](".$url.")"; | |
$wf->result( time(), $md, $title, $url, 'icon.png' ); | |
echo $wf->toxml(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment