Closed ml-tn closed 9 years ago
I can't find a solution to this problem either. I have been stuck for a while now. Great code otherwise.
More info about the problem: Twitter Search API formats JSON like this: http://jsoneditoronline.org/?id=e1cf1c7f8be54622bbe8912d32a0f416
This code in this repository works great when JSON is formatted as: http://jsoneditoronline.org/?id=39a27a80eca7bb8f748c2a87b261a831
@ml-tn e @mikestratton
You are running the script in the same url that registered on the twitter app? When localhost access the return is NULL, when URL access that signed up on twitter it returns the json.
Perhaps this is the problem of you out there.
@leobaiano your comment does not make sense. If you know how to fix the problem why don't you share some code?
@mikestratton, The only thing I did to solve my problem was up the files to the online server where the domain that signed up when I created the app on twitter are staying.
I was on twitter create the app and there put the meusite.com URL, ok? I started to test the code in localhost and only received in return NULL, ok? I uploaded the files and tested the code in meusite.com and returned the json.
You get the idea?
Can OP elaborate on the issue here?
Hi,
I have successfully called the TwitterAPIExchange.php in my PHP file but I'm unable to get the basic searching example to work.
I am using xampp on windows and I have checked that Curl is enabled. What's the problem ?
<?php require_once('./TwitterAPIExchange.php');
$settings = array( 'oauth_accesstoken' => "**", 'oauth_access_tokensecret' => "**", 'consumerkey' => "**", 'consumersecret' => "**" ); $url = 'https://api.twitter.com/1.1/search/tweets.json'; $getfield = '?q=army'; $requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);
$response = $twitter->setGetfield($getfield) ->buildOauth($url, $requestMethod) ->performRequest(); var_dump(json_decode($response));
?>
The var_dump gives me a NULL result.