Is it possible to read files from external website and then change some data on it and then display on the website?
Example :
Let say i have two website example.com & example.net and I want to read the file from example.net, make some changes to the data/variable and then printing it on example.com.
Let say content of Example.net :
<a href="http://example.net/something"><img src="happy.png" alt="Stackoverflow"></a>
I want to change the link from http://example.net/something to http://example.com/something and image from happy.png to sad.png and then print on example.com using file_get_contents('https://www.example.net/')
My Code for example.com:
$homepage = file_get_contents('https://www.example.net/');
$homepage = str_replace("happy", "sad", $homepage);
$homepage = str_replace("example.net", "example.com", $homepage);
echo $homepage;
Output of example.com after read, change and display (Looking for) :
<a href="http://example.com/something"><img src="sad.png" alt="Stackoverflow"></a>
Is this possible?, If yes, Then how can i make it?. Please help!!