Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

264
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda