Answer the question
In order to leave comments, you need to log in
How to interact with the site through the parser?
I want to parse the data, for this you need to:
1) Get the page
2) Select the necessary items from the select on it
3) Send data to a specific field
4) Press the submit button
5) Pump out the result
During this whole thing, the URL does not change, so I do not I can send data through the browser line. I quickly figured out how to get the code, but what words to google in general to do this filling out forms and sending? How does is called?
Answer the question
In order to leave comments, you need to log in
First you need to understand how HTML forms work:
php.net/manual/ru/language.variables.external.php
And you can find out a little more about what kind of data you want to "pump out" with the parser? Perhaps they are already in the public domain, but you don't know about them...
Very similar to a list of countries/regions/cities...
if only for one specific form - then:
select the data in the select with your hands, open the Console / Network in the browser, click Send, study the request that was sent to the server and the server response.
then write a script that sends curl a series of the same POST(?) requests with different data (alternately throwing up data from the options) and parses the responses.
well, i.e. the bottom line is that it is not necessary to simulate the selection from the select and clicks on the buttons. it is enough to simulate the http requests that the front communicates with the back.
If you are familiar with nodejs. There is a good solution in the form of nightmarejs . it is essentially a headless browser. You can pull data, or interact with the site.
If you need to exactly emulate user behavior and specifically with php, I advise you to take a closer look at Codeсeption with its PhpBrowser ( https://www.toptal.com/php/php-testing-with-codeception - there is an example with filling and submitting a form at the link).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question