NameSilo

How to read HTML or TXT file and output the data?

Spaceship Spaceship
Watch
Impact
0
Does anyone know if this is possible?
Script reads a HTML file or a TXT file and output the data to MySQL database.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
What format is the data in the html or text file in? It's probably possible to parse it using php.
 
0
•••
It is certainly possible to read a file with PHP with file() or file_get_contents() or fread(). Once you have read the information you can do what you like with it, including saving it to a database. If you are more specific with what data you have and what exactly you need to do with it you might get better information.
 
0
•••
use this and change the lines with //update to match what you have.

PHP:
$file = "location/filename.extension"; //update
$databasehost = "localhost"; //update
$databaseuser = "username"; //update
$databasepassword = "password"; //update
$databasename = "name"; //update

if(file_exists($file)) {
  $content = addslashes(@file_get_contents($file));
  @mysql_connect($databasehost,$databaseuser,$databasepassword);
  @mysql_select_db($databasename);
  @mysql_query("insert into tablename values(...,'$content',...)");  //update
}
 
Last edited:
0
•••
Appraise.net

We're social

Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back