有可能在PHP中使用php自动登录 [英] Is is possible in PHP to autologin using php
本文介绍了有可能在PHP中使用php自动登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人都可以建议
是否有可能使用我们可以通过用户名或密码,APP_ID或APP_SECRET的任何API在fb中自动登录。
尽快回复。
-----------------------
谢谢
我实现了以下代码
can any one suggest
is there any possiblity to autologin in fb using any API in which we can pass Username or Password, APP_ID or APP_SECRET.
Reply ASAP.
-----------------------
Thanks
I have implement following code
<?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;
?>
推荐答案
app_id = xxx;
app_id = "xxx";
app_secret = XXXX跨度>;
echo
app_secret = "xxxx"; echo
app_id ;
函数post_url(
app_id; function post_url(
这篇关于有可能在PHP中使用php自动登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文