File_get_contents() error

Hi
I recently installed a fresh installation of Ubuntu Server 20.04 LTS.
I followed widely used instructions on how to install the LAMP stack too, with those instructions I am using PHP 7.4 and Apache2.
I’m trying to use the file_get_contents() command In PHP on a pastebin raw URL (pastebin.com/raw/) but for whatever reason the page is blank. Here is my code:

<?php
$paste = file_get_contents($url);
echo $paste;
?>

Note: $url is defined with the url that I’m using.

In my php.ini, allow_url_fopen is set to true.

If anyone could help me make file_get_contents() work that would be greatly appreciated!
Many thanks.

Fixed my own issue, the issue lied in a discrepancy in the character sets between the 2 servers. Using header() to set the character set fixed my issue

Sponsor our Newsletter | Privacy Policy | Terms of Service