file_get_contents command does not work

Hello everyone, first of all, I apologize to everyone for translation errors

I started doing research to extract data from websites and found some documents and run them on my local host, then I uploaded the code to my server, but the data did not come

pkgs:
nginx-1.20.0_1,2
php80-8.0.6


my website code:
Code:
<?php

function getir($baslangic, $son, $cekilmek_istenen)
{
    @preg_match_all('/' . preg_quote($baslangic, '/') .
    '(.*?)'. preg_quote($son, '/').'/i', $cekilmek_istenen, $m);
    return @$m[1];
}



//Ankr Coin
$url = "https://coinmarketcap.com/currencies/ankr/";

$icerik = file_get_contents($url);

$AnkrCoin = getir('<div class="priceValue___11gHJ">','</div>',$icerik);




//Eose
$url = "https://coinmarketcap.com/currencies/eos/";

$icerik = file_get_contents($url);

$EosCoin = getir('<div class="priceValue___11gHJ">','</div>',$icerik);



//Atom
$url = "https://coinmarketcap.com/currencies/cosmos/";

$icerik = file_get_contents($url);

$CosmosAtom = getir('<div class="priceValue___11gHJ">','</div>',$icerik);




//Mkr
$url = "https://coinmarketcap.com/currencies/maker/";

$icerik = file_get_contents($url);

$Mkr = getir('<div class="priceValue___11gHJ">','</div>',$icerik);
?>

<html>

<head>
  <meta http-equiv="refresh" content="5">
</head>

<body>

  <div id="AnkCoin">
    <p>
      Ankr:<?php echo $AnkrCoin[0]; ?>
    </p>
  </div>

  <div>
    <p>
      Eos: <?php echo $EosCoin[0]; ?>
    </p>
  </div>

  <div>
    <p>
      Cosmos Atom: <?php echo $CosmosAtom[0]; ?>
    </p>
  </div>
  <div>
    <p>
      Mkr: <?php echo $Mkr[0]; ?>
    </p>
  </div>
</body>
</html>
thanks in advance for your help
 

Attachments

  • nginx.conf
    4.7 KB · Views: 171
  • php.ini
    70.9 KB · Views: 156
  • www.conf
    20.3 KB · Views: 162
run phpinfo() on the 'server' and see if allow_url_fopen is on
1621769010064.png

its on


I can see google in the expressions like this command
Code:
<?php
$homepage = file_get_contents('http://www.google.com/');
echo $homepage;
?>
1621769214638.png

but nothing happens when i change the link
for example
Code:
<?php
$homepage = file_get_contents('https://coinmarketcap.com/currencies/eos/');
echo $homepage;
?>

There is no problem when I open it using local xampp
 
Back
Top