+ 3
How to read html page source code and write some value in php?
How to read html page source code and get some value from html page source code? After that I want to write the value of my PHP code? How does it?
2 Answers
+ 1
If you're a webpage in a server other than your local PC, then whenever you enter the address, you just create GET request through your browser to deliver it to server, which in turn returns your page & you can read the HTML from developers' tool.
Now, the interaction(interesting!) part.....suppose you're to submit a form. Once you click the submit button the relevant information you've entered is then analysed by a server side scripting language(that's where PHP comes in!)
From your question though, it looks like you want to manipulate the HTML source code, but that's absurd. Why would you wanna do that stuff with PHP when you've JavaScript at your disposal! Remember, HTML, CSS & JavaScript reside on the client-side i.e. the browser but PHP operates on server-side along with a OS(Linux) and Database(MongoDB/MySQL)........so the performance of the 'action' depends on internet connection & its stability........
JavaScript is mainly used to manipulate HTML by accessing it's DOM & you can literally change the source code of any HTML with JS!
0
I think I understand your first question, but I don't understand the second.
To your first question, I believe what you are trying to do is called "web scraping". https://youtu.be/r_xb0vF1uMc
You would use Python or Ruby to extract whatever you wanted from the html.
To your second question, you would then pass the information from your python script to the PHP script on your website.