I'm using Abraham's twitteroauth class and after authenticating a user I'm trying to grab a list of ids the user is following.
Authentication works fine because I can run:
$user = $connection->get('account/verify_credentials');
And get the required result. So according to the test.php file on Github's twitteroauth I should also be able to run the following:
$friends = $connection->get('statuses/friends');
But if I var_dump the output I get the following:
stdClass Object( [errors] => Array ( [0] => stdClass Object ( [message] => Sorry, that page does not exist [code] => 34 ) ))
The "statuses/friends" seems to be the wrong request, so could anyone point me in the right direction?
Should have read a bit further. The answer is to go for:
$friends = $connection->get('friends/ids');
Related
I want laravel backend to send a message to my Ionic App whenever there is an entry in my database. I don't want to do polling at frontend, found this library rukavina/kurento-client-php
(https://github.com/rukavina/kurento-client-php) but unable to get any success as I was getting this error.
Array (
[code] => 40201
[data] => Array (
[type] => SDP_PARSE_ERROR
)
[message] => Empty offer not valid
)
Can anyone help me who either implemented kurento-client-php library or worked on similar situation.
Finally did it using Laravel-ratchet and php-zmq.
Anybody knows a way to get email id from vk social site? When I am trying, it is providing only below information.
stdClass Object ( [response] => Array ( [0] => stdClass Object ( [uid] => 322372142 [first_name] => Gaurav [last_name] => Pal ) ) )
Am using above below code to make a call.
$success = $client->CallAPI('https://api.vk.com/method/users.get','GET', array(), array('FailOnAccessError'=>true), $user);
I have found a way to get email from VK.
First fetch "CODE" from below url
https://oauth.vk.com/authorize?client_id=MY_CLIENT_ID&scope=email&redirect_uri=MY_REDIRECT_URL&response_type=code
Now send CURL request to get "EMAIL", "USER_ID", "ACCESS_TOKEN" from below url:
https://api.vk.com/oauth/access_token?client_id=MY_CLIENT_ID&client_secret=MY_CLIENT_SECRET_KEY&code=FETCHED_CODE&redirect_uri=MY_REDIRECT_URL
To get information other than email, use below URL
https://api.vk.com/method/users.get?uids=FETCED_USER_ID&access_token=FETCHED_ACCESS_TOKEN
There is no way to get user email or mobile phone attached to his page. You should not try. Just trust me as worker with vk api for many years.
I've got a REST call to my Google calendar that works out fine on my old website (www.gmbc.org/events.php), but when the identical call is made from a codeigniter controller, the timeMin / timeMax options cause it to throw a 400 at me (remove them, and the call successfully retrieves the whole calendar from 2012):
$st_date = date(DateTime::ATOM);
$end_date = date(DateTime::ATOM, time()+(31 * 24 * 60 * 60));
$call_url = 'https://www.googleapis.com/calendar/v3/calendars/calendar%40gmbc.org/events?timeMin='.$st_date.'&timeMax='.$end_date.'&singleEvents=true&orderBy=startTime&key=[mykeythatworksjustfine]';
$events_call = $this->curl_get($call_url);
echoing $call_url confirms it's being created identically, and print_r-ing the result confirms it's reaching google:
stdClass Object (
[error] => stdClass Object (
[errors] => Array (
[0] => stdClass Object (
[domain] => global [reason] => badRequest [message] => Bad Request )
)
[code] => 400 [message] => Bad Request
)
)
...what could possibly be going on? Does codeigniter interfere with the curl call?
I am able to successfully retrieve events from this calendar with TimeMin and TimeMax set using the API explorer: https://developers.google.com/apis-explorer/#p/calendar/v3/calendar.events.list?calendarId=calendar%2540gmbc.org&timeMax=2014-11-30T00%253A00%253A00Z&timeMin=2014-10-01T00%253A00%253A00Z&_h=2&
The query it's sending is:
GET https://www.googleapis.com/calendar/v3/calendars/calendar%40gmbc.org/events?timeMax=2014-11-30T00%3A00%3A00Z&timeMin=2014-10-01T00%3A00%3A00Z&key={YOUR_API_KEY}
Try making sure the query you are sending from PHP ends up the same.
I have enabled billing and have 10$ balance in my project,
I have created Key for browser applications, with right referrer
I have generate key , my code is given below
$api_key = 'My Key is Here';
$response = file_get_contents('https://www.googleapis.com/language/translate/v2?key='.$api_key.'&q=hello%20world&source=en&target=de');
//decode json to array
$json = json_decode($response);
//show the json array in a readable format
echo '<pre>';
//show array
print_r($json);
I am getting following errors
stdClass Object
(
[error] => stdClass Object
(
[errors] => Array
(
[0] => stdClass Object
(
[domain] => usageLimits
[reason] => accessNotConfigured
[message] => Access Not Configured. Please use Google Developers Console to activate the API for your project.
)
)
[code] => 403
[message] => Access Not Configured. Please use Google Developers Console to activate the API for your project.
)
)
Please would you help me to figure out, what i have missed or did wrong that i get above error.
Many Thanks
Make sure you have enabled translate API in developer console.
How can I retrieve a specific post/discussion from a open group through LinkedIn API using PHP.
I was trying with the following API request as shown in here http://developer.linkedin.com/documents/groups-api#post :
https://api.linkedin.com/v1/posts/5835685921059532803:(id,type,category,creator,title,summary,creation-timestamp,relation-to-viewer:(is-following,is-liked,available-actions),likes,comments,attachment,site-group-post-url)
But this returns the following error:
Array
(
[status_code] => 400
[data] => stdClass Object
(
[errorCode] => 0
[message] => Invalid Post.id String {5835685921059532803}
[requestId] => XW2XMPBNKY
[status] => 400
[timestamp] => 1391441328953
)
)
Now, what's the error I have made with this request? What should I do to get a specific discussion?
Thanks.
I just solved the problem. The problem was while making the request. The discussion id (5835685921059532803) I was sending with URL was in wrong format. It should be like: g-GROUP_ID-S-DISCUSSION/POST_ID, for example: g-24405-S-5835685921059532803.
So the URL should be:
https://api.linkedin.com/v1/posts/g-24405-S-5835685921059532803:(id,type,category,creator,title,summary,creation-timestamp,relation-to-viewer:(is-following,is-liked,available-actions),likes,comments,attachment,site-group-post-url)
Hope this would save someone's valuable time.
You need An Api key and Secret key,to get an AUTHORIZATION_CODE,using that AUTHORIZATION_CODE,you will get an Access Token,and with that Access Token if you hit the url,then you will get the proper data,
details http://developer.linkedin.com/documents/authentication