I haven't done anything like this before. Trying to figure it out from scratch. The task is to write code that will receive information from someone else's website on a timer. About how their server is arranged, I do not know anything. Therefore, I would like to know what algorithm to act on? How can I find out how it works and what kind of request should I send? I will implement on javascript.

Now that I have already tried to do. There is a site for applying . The user selects Consulate General of Finland, St. Petersburg and click "Send." Then from the select element, the user selects the purpose of the visit, say, Tourism. At the time of changing the selected item, an inscription appears: either that there are no available dates (as often happens), or displays an available date. This select element has the following property:

onchange="javascript:setTimeout('__doPostBack(\'ctl00$plhMain$cboVisaCategory\',\'\')', 0)" 

In the Network tab of the developer’s panel you can see that a post request is being sent. Most of it is occupied by the so-called "Form Data", the content of which is an unreadable combination of characters. And another thing: the request has a cookie, some ASP_session. And also there is a site where such a task has already been done: http://visastat.ru. Actually, having learned about him, I decided for educational purposes to figure out how it works.

    1 answer 1

    Still, the goal is not entirely clear. Anyway.

    If it was about how to do a periodic survey of your resource, then you need to use AJAX. There is a lot of information on this topic. You can start, for example, with Ajax In Action ( AJAX in action ). It is already beginning to become obsolete, but it is still relevant and will fit for learning.

    When it comes to polling someone else's resource, then AJAX is no good. The main reason is the security policy, which does not allow making requests to foreign resources. There are two ways out in this situation: proxying on your server, or using a hidden iframe. The first approach on the client side, you can use regular AJAX. You will also have more control over the process. The second way does not require anything from your server side, but will cause a number of difficulties in managing the loading in the iframe in different browsers. Among the problems, for example, is the inability to detect an unexpected disconnection during data loading.

    Given the different pros and cons, you should choose the way that is convenient for you.

    In this case, you also have a certain resource and you need to understand what needs to be transferred there in order for it to work and you need to understand what it will return as an answer. Unfortunately, it may turn out that it is simply impossible to recognize this. If you can not find any documentation about what is happening there, then you can apply reverse engineering: try to guess what the transmitted information means in different cases. You can also try to format the JavaScript of the site that already knows how to work with this data and try to understand it. In general, I am not sure that such excavations - a useful pastime and educational effects will be minimal.

    • Look, I wrote at the end of the message that someone did release something like this: visastat.ru . If we talk about the goal, then the point is that a Finnish visa can be obtained free of charge at the consulate and for 21 euros in the visa center. But it is necessary to sign up to the consulate through the Internet site, see the link. The recording opens for a few minutes a day, the max. Period is half an hour. But one smart programmer wrote a resource that keeps track of whether registration is open, and also has a history of registrations. A lot of people visit the site, people posted ads and rejoices. - angry
    • Did I really say that this is impossible? Simply, if the data is completely unreadable, then without a certain preparation and intuition you will not reveal the encoding. - cy6erGn0m
    • Sadly However, everything is very difficult. - angry
    • On the other hand, if you are always afraid of everything, then you will bypass the interesting tasks. So it's worth a try, but don't hope for hope. - cy6erGn0m