Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

256
Views
File get contents - Read, Change and display

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!!

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!