Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

PHP 

Open a file HTML from PHP and get CONTENT

Hello everyone, I make this request perhaps a bit 'foolish but I find myself to have a static site, with over 3000 pages, all equal the only difference in small content, such as the title, image, text and other data, I wanted to know if it were possible create a script via php that would allow me to get these changes, from them generate a sql script to insert them into a database.

I have an idea of how to open files and more, but xml or ini, never happened to work on html and get data from it.

sorry for my bad english.
Thank you :)
(Jan 18, 2019 09:45 AM)MXD-Takeshi Wrote:  Hello everyone, I make this request perhaps a bit 'foolish but I find myself to have a static site, with over 3000 pages, all equal the only difference in small content, such as the title, image, text and other data, I wanted to know if it were possible create a script via php that would allow me to get these changes, from them generate a sql script to insert them into a database.

I have an idea of how to open files and more, but xml or ini, never happened to work on html and get data from it.

sorry for my bad english.
Thank you :)

You could create Regular Expressions to fetch data from the loaded pages such as title and content.
Then you can push these information to the database and load the next html file.
You're trying to parse the HTML elements and grab the text from within them? Yes, PHP can do this with either an existing library or using regex (harder).
-- https://stackoverflow.com/questions/1834...tml-in-php
-- http://php.net/manual/en/domdocument.loadhtml.php
-- Google

If this is a one time thing, I say skip using PHP and hand the job off to Python.
-- https://stackoverflow.com/questions/1170...ing-python
-- https://stackoverflow.com/questions/3728...-in-python
Or save it as a CSV file, which would require less work
-- https://stackoverflow.com/a/1871557/4149581

Je t'aime
[Image: fpZ5a5g.png]

(Apr 22, 2022 04:39 PM)-Scrub Wrote:  Jokes on you, I'm not smart enough to know what he's talking about.
You could use file_get_contents() & regex to get the values of the title/etc


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Javascript]  by flexing_99Apr 29, 2023 12:02 AM 3 269 Apr 29, 2023 12:02 AM
Last Post: Zgh600
[PHP] by Shellcode™Nov 19, 2022 07:03 AM 2 167 Nov 19, 2022 07:03 AM
Last Post: Hackers
[Javascript]  by flexing_99Jul 4, 2020 04:11 PM 0 130 Jul 4, 2020 04:11 PM
Last Post: flexing_99