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

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