Created
June 21, 2012 04:26
-
-
Save riaf/2963830 to your computer and use it in GitHub Desktop.
コマンドラインで OGP をデバッグする ref: http://qiita.com/items/d132f8a5f0961502bad5
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
#!/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)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment