<?php $app_id = "xxx"; $app_secret = "xxxx"; echo $app_id; function post_url($url, $params) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params, null, '&')); $ret = curl_exec($ch); echo $ret; curl_close($ch); return $ret; } function get_app_access_token($app_id, $secret) { $url = 'https://graph.facebook.com/oauth/access_token'; $token_params = array("type" => "client_cred","client_id" => $app_id,"client_secret" => $secret ); return str_replace('access_token=', '', post_url($url, $token_params)); } $token = get_app_access_token($app_id,$app_secret); echo $token; ?>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)