php - Concatenating twitter api get request while using variables -


i have lat , long saved this,

$lat_value = $_request['latitude']; $lon_value = $_request['longitude']; 

when adding variables $getfield string this,

$getfield = '?q=test&geocode='.$lat_value.','.$lon_value.',1mi&count=100'; 

i keep getting error,

"you must provide valid coordinates, ip address, query, or attributes." } 

if it's syntax error please explain why not work me.

full request , response code,

<?php error_reporting(e_all);  $lat_value = $_request['latitude'];       $lon_value = $_request['longitude'];  require_once('twitterapiexchange.php');  /** set access tokens here - see: https://dev.twitter.com/apps/ **/ $settings = array(     'oauth_access_token' => "xxx",     'oauth_access_token_secret' => "xxx",     'consumer_key' => "xxx",     'consumer_secret' => "xxx" );  $url = 'https://api.twitter.com/1.1/geo/search.json'; $getfield = '?q=test&geocode='.$lat_value.','.$lon_value.',1mi&count=100';  $requestmethod = 'get';  $twitter = new twitterapiexchange($settings);  // response twitter  $response = $twitter->setgetfield($getfield)     ->buildoauth($url, $requestmethod)     ->performrequest();   var_dump(json_decode($response)); 

as per documentation says, have specify either lat, long, ip or query, , not specifying of them. don't see of parameters in querystring.

try query:

$getfield = "query=test&lat={$lat_value}&long={$lon_value}&accuracy=1m&max_results=100" 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -