Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function GetCH(){
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, "https://graph.facebook.com/oauth/access_token?client_id=YourAppId&client_secret=YOUR_APP_SECRET&grant_type=client_credentials");
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
- //curl_setopt($ch,CURLOPT_CONNECTTIMEOUT_MS,20000);
- if(substr($url,0,8)=='https://'){
- // The following ensures SSL always works. A little detail:
- // SSL does two things at once:
- // 1. it encrypts communication
- // 2. it ensures the target party is who it claims to be.
- // In short, if the following code is allowed, CURL won't check if the
- // certificate is known and valid, however, it still encrypts communication.
- curl_setopt($ch,CURLOPT_HTTPAUTH,CURLAUTH_ANY);
- curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
- }
- $sendCH = curl_exec($ch);
- curl_close($ch);
- return $sendCH;
- };
- $app_token = GetCH();
- print_r(GetCH())
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement