Bu allow_url_fopen komutu birçok hazır script ve kurulumda canımı sıkıyor, bir kere adam gibi toparlayabilsem gerçekten keyif alıcam, hızlı da olucak ama yok, oluyor.
Bu sefer de facebook login içerisinde aynı sıkıntıyı yaşıyorum.
$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);
$params = null;
parse_str($response, $params);
$graph_url = "https://graph.facebook.com/me?access_token="
. $params['access_token'];
$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");
//pics
$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";
iki noktada
file_get_contents canımı sıkıyor. Bu kodları curl'e çevirirseniz felaket mutlu olacağım.. bütün günümü buna harcadım resmen, üstüne host ile tartıştım, sonuç sıfır.
Arkadaşım yukarıda arkadaşlar vermiş zaten. Tekrar edecek olursak fonksiyon.php vb. bir dosyan varsa içine, yoksa kullandığın dosyanın başına bunu ekle:
function curl_get_contents($adres){
$timeout = 0;
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_URL, $adres);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$gelen = curl_exec($ch);
if(curl_errno($ch)) print curl_error($ch);
curl_close($ch);
return $gelen;
}Daha sonra kodlarında file_get_contents olan yerleri curl_get_contents olarak değiştir, yani:
$response = @file_get_contents($token_url);
yerine
$response = curl_get_contents($token_url);
gibi.