Skip to content

Instantly share code, notes, and snippets.

@Leko
Created July 14, 2013 08:58
Show Gist options
  • Save Leko/5993679 to your computer and use it in GitHub Desktop.
Save Leko/5993679 to your computer and use it in GitHub Desktop.
Markdown Link Generator
<?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