2 ini_set('display_errors', 1);
3 require_once('TwitterAPIExchange.php');
5 /** Set access tokens here - see: https://dev.twitter.com/apps/ **/
7 'oauth_access_token' => "",
8 'oauth_access_token_secret' => "",
10 'consumer_secret' => ""
13 /** URL for REST request, see: https://dev.twitter.com/docs/api/1.1/ **/
14 $url = 'https://api.twitter.com/1.1/blocks/create.json';
15 $requestMethod = 'POST';
17 /** POST fields required by the URL above. See relevant docs as above **/
19 'screen_name' => 'usernameToBlock',
23 /** Perform a POST request and echo the response **/
24 $twitter = new TwitterAPIExchange($settings);
25 echo $twitter->buildOauth($url, $requestMethod)
26 ->setPostfields($postfields)
29 /** Perform a GET request and echo the response **/
30 /** Note: Set the GET field BEFORE calling buildOauth(); **/
31 $url = 'https://api.twitter.com/1.1/followers/ids.json';
32 $getfield = '?screen_name=J7mbo';
33 $requestMethod = 'GET';
34 $twitter = new TwitterAPIExchange($settings);
35 echo $twitter->setGetfield($getfield)
36 ->buildOauth($url, $requestMethod)