2010-11-20 11 views
2

sarıcı https desteklemez daha dont: Eğer protokol https görebileceğiniz gibibir https web sayfasını okumak gerekiyor ama benim web sunucusu ben bu basit komutla php kullanarak bir web sayfasının içeriğini okumak gerekir

$pagina='https://graph.facebook.com/me?access_token=' . $cookie['access_token']; 
$user = json_decode(file_get_contents($pagina)); 

. i çalıştırdığınızda bu hep olsun komutları:

[function.file-get-içeriği]: Bu kodu kullanmak stackoverflow bazı kullanıcı diğer cevap olarak

öneririz: akışını açmak için başarısız oldu: benim sunucu https sarmalayıcı varsa amacıyla

$w = stream_get_wrappers(); 
echo 'openssl: ', extension_loaded ('openssl') ? 'yes':'no', "\n"; 
echo 'http wrapper: ', in_array('http', $w) ? 'yes':'no', "\n"; 
echo 'https wrapper: ', in_array('https', $w) ? 'yes':'no', "\n"; 
echo 'wrappers: ', var_dump($w); 

bilmek ve sonuç sayılı

oldu Yani, IR nasıl bir fikrin php kullanarak bu https sayfasını kullan? Belki CURL ile herhangi bir örnek kod? Çok teşekkürler!

cevap

2

Https siteleri kıvrılma ile çalışmak

<?php 
$url = "https://www.google.com/"; 
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, "$url"); 
curl_setopt($ch, CURLOPT_HEADER, 0); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); 
$result = curl_exec($ch); 
curl_close($ch); 
echo $result; 
?> 
+0

sonuç ... ve – DomingoSL

+0

vadede curl_exec sonra bu kod vardump bool (false) ile boş -> echo curl_error ($ ch); hata mesajını görmek için – ynh

İlgili konular