ついにできた。
(全体は下記を参照)
http://blog.monqy.net/2016/05/phptwitter-api-oauth.html
<?php
session_start();
require_once 'common.php';
require_once 'vendor/abraham/twitteroauth/autoload.php';
use Abraham\TwitterOAuth\TwitterOAuth;
$access_token = $_SESSION['access_token'];
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_s
ecret']);
$user = $connection->get("account/verify_credentials");
echo 'hello, ';
echo $user->name;
$req2 = $connection->OAuthRequest('https://api.twitter.com/1.1/blocks/list.json','GET',array('count'=>'100'));
$blocks = json_decode($req2,true);
if (isset($blocks) && empty($blocks->errors)) {
echo '<hr>';
foreach ($blocks as $val) {
for($i = 0; $i<count($val)-1;$i++)
{
echo
$val[$i]['name'] . '<br>'
. '<img src="' . $val[$i]['profile_image_url'] . '"><br>'
. $val[$i]['screen_name'] . '<br>'
. '<hr>';
}
}
echo '<hr>';
} else {
echo 'you are blocking nobody.';
}
?>