Unable to put localhost Settings Website (http://localhost/sites/twitter-api-php-master/)


#1

I’m creating a php web application that can post tweets using my website and monitor that tweet.
For now I’m using php localhost, but cant put my localhost url to Website Settings

Error
Validation failed: Not a valid URL format

This is my first application in php and I’m confused

No offense, I already try this on facebook developer and my localhost url is accepted
Dont know if the settings is the same as in facebook.


#2

Just fill in http://invalid.tld and you’ll be fine.


#3

i already change the website, bu i can’t run the sample code that i downloaded
content is blank

<?php ini_set('display_errors', 1); require_once('TwitterAPIExchange.php'); /** Set access tokens here - see: https://dev.twitter.com/apps/ **/ $settings = array( 'oauth_access_token' => "my app token", 'oauth_access_token_secret' => "my app token secret", 'consumer_key' => "api key", 'consumer_secret' => "api secret" ); /** URL for REST request, see: https://dev.twitter.com/docs/api/1.1/ **/ $url = 'https://api.twitter.com/1.1/blocks/create.json'; $requestMethod = 'POST'; /** POST fields required by the URL above. See relevant docs as above **/ $postfields = array( 'screen_name' => 'hansoctantan', 'skip_status' => '1' ); /** Perform a POST request and echo the response **/ $twitter = new TwitterAPIExchange($settings); echo $twitter->buildOauth($url, $requestMethod) ->setPostfields($postfields) ->performRequest(); /** Perform a GET request and echo the response **/ /** Note: Set the GET field BEFORE calling buildOauth(); **/ $url = 'https://api.twitter.com/1.1/followers/ids.json'; $getfield = '?screen_name=hansoctantan'; $requestMethod = 'GET'; $twitter = new TwitterAPIExchange($settings); echo $twitter->setGetfield($getfield) ->buildOauth($url, $requestMethod) ->performRequest();

#4

i just updated the settings website, and try this code

<?php ini_set('display_errors', 1); require_once('TwitterAPIExchange.php');

/** Set access tokens here - see: https://dev.twitter.com/apps/ **/
$settings = array(
‘oauth_access_token’ => “oauth_access_token’”,
‘oauth_access_token_secret’ => “oauth_access_token_secret’”,
‘consumer_key’ => “consumer_key’”,
‘consumer_secret’ => “consumer_secret”
);

/** URL for REST request, see: https://dev.twitter.com/docs/api/1.1/ **/
$url = ‘https://api.twitter.com/1.1/blocks/create.json’;
$requestMethod = ‘POST’;

/** POST fields required by the URL above. See relevant docs as above **/
$postfields = array(
‘screen_name’ => ‘hansoctantan’,
‘skip_status’ => ‘1’
);

/** Perform a POST request and echo the response **/
$twitter = new TwitterAPIExchange($settings);
echo $twitter->buildOauth($url, $requestMethod)
->setPostfields($postfields)
->performRequest();

/** Perform a GET request and echo the response /
/
Note: Set the GET field BEFORE calling buildOauth(); **/
$url = ‘https://api.twitter.com/1.1/followers/ids.json’;
$getfield = ‘?screen_name=hansoctantan’;
$requestMethod = ‘GET’;
$twitter = new TwitterAPIExchange($settings);
echo $twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest();
?>

when i open this to a browser, output is blank