ex de site en utilisant ssl (HTTPs): https://www.eb2a.comcomment obtenir le contenu du site Utiliser HTTPS
1 - j'ai essayé d'obtenir son contenu à l'aide file_get_contents, mais fonctionne pas et donner erreur ex:
<?php
$contents = file_get_contents("https://www.eb2a.com/");
echo $contents;
?>
2 - j'ai essayé d'utiliser fopen, mais pas travailler et donner erreur ex:
<?php
$url = 'https://www.eb2a.com/';
$contents = fopen($url, 'r');
echo "$contents";
?>
3 - j'ai essayé d'utiliser CURL, mais pas travailler et donner PAGE BLANK ex:
function cURL($url, $ref, $header, $cookie, $p){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_REFERER, $ref);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
if ($p) {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $p);
}
$result = curl_exec($ch);
curl_close($ch);
if ($result){
return $result;
}else{
return '';
}
}
$file = cURL('https://www.eb2a.com/','https://www.eb2a.com/',0,0,null);
echo $file
quelqu'un a une idée ??
Quelle erreur obtenez-vous? –
duplication possible de [file_get_contents avec https?] (Http://stackoverflow.com/questions/1975461/file-get-contents-with-https) – VolkerK
Vous avez la réponse ici: [how-to-get-file-get -contents-work-with-https] (http://stackoverflow.com/questions/1975461/how-to-get-file-get-contents-work-with-https) – Roberto