我完全是新手:由于以下代码,我的脚本出现了问题:
$user = json_decode(file_get_contents($graph_url));
*file_get_contents failed to open stream : no suitable wrapper found*
我试图用堆栈上的卷曲来解决
function my_curl_fun($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$data = curl_exec($ch);
curl_close($ch);
return $user;
}
$graph_url = "http://graph.facebook.com/me?&fields=email,name&access_token=".$scriptolutionaccesstoken; //up1
$user = my_curl_fun($graph_url);
$code = htmlentities(strip_tags(stripslashes($_REQUEST['code'])), ENT_COMPAT, "UTF-8");
if($code != "")
{
$my_url = $config['baseurl']."/";
$token_url = "https://graph.facebook.com/oauth/access_token?"
. "client_id=" . $A . "&redirect_uri=" . urlencode($my_url)
. "&client_secret=" . $B . "&code=" . $code;
$response = file_get_contents($token_url);
preg_match_all("/access_token\"\:\"(.+?)\"/", $response, $scriptolution7);
$scriptolution6 = array_unique($scriptolution7);
$scriptolutionaccesstoken = $scriptolution6[0][0];
$scriptolutionaccesstoken = str_replace(":", "", $scriptolutionaccesstoken);
$scriptolutionaccesstoken = str_replace("\"", "", $scriptolutionaccesstoken);
$scriptolutionaccesstoken = str_replace("access_token", "", $scriptolutionaccesstoken);
$params = null;
parse_str($response, $params);
$graph_url = "https://graph.facebook.com/me?&fields=email,name&access_token=".$scriptolutionaccesstoken; //up1
$user = json_decode(file_get_contents($graph_url));
$fname = htmlentities(strip_tags($user->name), ENT_COMPAT, "UTF-8");
$femail = htmlentities(strip_tags($user->email), ENT_COMPAT, "UTF-8");
$fbpid = htmlentities(strip_tags($user->id), ENT_COMPAT, "UTF-8");
$fbpicurl = "http://graph.facebook.com/".$fbpid."/picture";
$fbpicurl2 = "http://graph.facebook.com/".$fbpid."/picture?type=large";
$query="SELECT USERID FROM members WHERE email='".mysqli_real_escape_string($conn->_connectionID, $femail)."' limit 1";
$executequery=$conn->execute($query);
$FUID = intval($executequery->fields['USERID']);