コマンドラインで OGP をデバッグする
Facebook のデバッガー ( http://developers.facebook.com/tools/debug ) も便利ですが、Graph API 経由でも ogp を確認出来ます。
#!/usr/bin/env php
<?php
if (!isset($argv[1])) {
echo "Usage: php ogp.php [URL]", PHP_EOL;
exit;
}
$data = http_build_query(array(
'id' => $argv[1],
'scrape' => 'true',
));
$context = array(
'http' => array(
'method' => 'POST',
'header' => implode("\r\n", array(
'Content-Type: application/x-www-form-urlencoded',
'Content-Length: '.strlen($data),
)),
'content' => $data,
),
);
var_dump(json_decode(file_get_contents(
'https://graph.facebook.com',
false,
stream_context_create($context)
), true));
うん、雑なコード。
Author And Source
この問題について(コマンドラインで OGP をデバッグする), 我々は、より多くの情報をここで見つけました https://qiita.com/riaf/items/d132f8a5f0961502bad5著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .