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

277
Vistas
How can i write a Template of HTML and create that HTML file with custom usernames as files_names when the API endpoints are hit in PHP?

So basically i need that when user registers in my Android App i will make a POST request with user Name and company Name that they wanted and i will create a html page with that data in the HTML Template. and webpage will be visible like this -> www.main-website.com/username [main-website.com is the domain that i have bought]

So what I did , is that I created a variable that stores the HTML Template with custom changes by adding php variables in-between.And then created a file.html. Check this code {and also If you know a better way to do this thing pls suggest [main idea -> userAuthenticate -> webpage created with username and company name as tags (this is protoype) ]

<!DOCTYPE HTML>
<?php
    if(isset($_POST['userName']) && isset($_POST['companyName'])){
        $user_name = $_POST['userName'];
        $company_name = $_POST['companyName'];
    }
    
    $my_var = <<<EOD
    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>template</title>
    </head>
    <body>
        <h1>This is  $user_name  </h1>
        <h2>My company name is  $company_name </h2>
    </body>
    </html>
    EOD;
    
    $fp = fopen($_SERVER['DOCUMENT_ROOT'] . "/myText.php","wb");
    fwrite($fp,$my_var);
    fclose($fp);
?>
over 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