Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

258
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda