4

ex of site using ssl ( HTTPs ) : https://www.eb2a.com

1 - i tried to get its content using file_get_contents, but not work and give error ex :

<?php
$contents = file_get_contents("https://www.eb2a.com/");

echo $contents;
?>

2 - i tried to use fopen, but not work and give error ex:

<?php
$url = 'https://www.eb2a.com/';
$contents = fopen($url, 'r');
echo "$contents";
?>

3 - i tried to use CURL, but not work and give BLANK PAGE 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

any one have any idea ??

Asaph
  • 159,146
  • 25
  • 197
  • 199
user346830
  • 41
  • 1
  • 1
  • 2
  • possible duplicate of [file_get_contents with https?](http://stackoverflow.com/questions/1975461/file-get-contents-with-https) – VolkerK May 21 '10 at 07:22
  • You have the answer here: [how-to-get-file-get-contents-work-with-https](http://stackoverflow.com/questions/1975461/how-to-get-file-get-contents-work-with-https) – Roberto Apr 14 '16 at 12:40
  • You may enable openssl extension in the php.ini as suggested by https://stackoverflow.com/a/2880176/1054582 – san May 19 '20 at 19:10

2 Answers2

1

To fetch the contents from secure protocal https, you need to have openssl extenstion enabled from php.ini file and the authentication for that matter.

Sarfraz
  • 377,238
  • 77
  • 533
  • 578
0

web site redirect 301

change url

from

https://www.eb2a.com/

to

https://www.eb2a.com

or if still not working or need use it with /

loook at LINK

use curl redirect rules

Mikel Tawfik
  • 658
  • 3
  • 9
  • 23