Solved

GET call facebook server from php

Posted on 2014-03-25
2
514 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 109

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 39954132
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 109

Expert Comment

by:Ray Paseur
ID: 39954463
Thanks for the points and thanks for using EE, ~Ray
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Owning a franchise can be the dream of a lifetime. It provides a chance for economic growth. You can be as successful as you want.  To make your franchise successful, you need to market it successfully. Here are six of the best marketing strategies …
The viewer will learn how to count occurrences of each item in an array.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

772 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