D
D
Dmitry Gusev2021-11-10 19:15:32
Parsing
Dmitry Gusev, 2021-11-10 19:15:32

How to select the desired city on the site when parsing goods?

Good afternoon! Please tell me, there is a site https://www.planeta-sirius.ru/ . It has the ability to select a city and each city has its own prices. I need to parse prices for a certain city, I use a php parser with URL.
How to send a request to change the city in cURL?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DENIS Kokorev, 2021-11-11
@dm_gusev

When you change the city in the form, a request like this goes to the server:
https://www.planeta-sirius.ru/udata/users/saveUser... (for example, Vsevolzhsk)
Perhaps at this moment the city will be saved in the session or database on the server.
Then stupidly the page will be refreshed. And already on the server the data for this session (user) is obtained.
And subsequent requests are already compared on the server with the city.
Put in chrome, Preserve Log on the network tab. Change the city in the form. You will see this get on the server.
618cde6b9489e760707215.jpeg

D
Dmitry Gusev, 2021-11-11
@dm_gusev

Good afternoon! I was just digging in this direction, thank you very much - I received a request for Moscow. How to embed this in curl now?. My function

function curlGetPage($url, $referer = 'https://www.planeta-sirius.ru/')
{

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 YaBrowser/21.6.4.787 Yowser/2.5 Safari/537.36');
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_REFERER, $referer);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    $response = curl_exec($ch);
    curl_close($ch);
    return $response;

}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question