Solved

GET call facebook server from php

Posted on 2014-03-25
2
506 Views
Last Modified: 2014-03-25
Hi

I'm writing some code that writes posts to facebook and the access token i get expires in an hour. In the docs it says to make this call to facebook server

https://developers.facebook.com/docs/facebook-login/access-tokens/

GET /oauth/access_token?  
    grant_type=fb_exchange_token&          
    client_id={app-id}&
    client_secret={app-secret}&
    fb_exchange_token={short-lived-token}

Sorry to be so daft but how do i do this i php? I dont know what the url of the facebook server is or how to make a get requests to it

Thanks
0
Comment
Question by:andieje
  • 2
2 Comments
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 500 total points
Comment Utility
I can't tell you the URL; Facebook would have to tell you that.  A GET request is made by putting the information into the URL request string.  So you could type it into a browser address bar or you could use PHP file_get_contents() or cURL.  Probably the things in curly braces are information that you will need to fill in.

$response = file_get_contents( {FACEBOOK URL}/oauth/access_token?grant_type=fb_exchange_token&client_id={app-id}&client_secret={app-secret}&fb_exchange_token={short-lived-token} );
var_dump($response);

Open in new window

0
 
LVL 108

Expert Comment

by:Ray Paseur
Comment Utility
Thanks for the points and thanks for using EE, ~Ray
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now