How to force the parser to follow links?

Good afternoon experts!

Recently asked the question about what tool to use to write easy and simple data parser from the site. Told me about Osmosis and Simple HTML DOM. Good stuff, but I had another question for him. How can you make these parsers to enter the data in fields and click buttons on the website?

In particular, the need for the equipment to enter the VIN number of the car, press the search button to go to a certain section and take rooms certain details. How it can be implemented? Thought to substitute your VIN in the address bar to a GET request, but the search generates a link like: https://сайт/модель/цифры/буквы:и:цифры/?vin=цифры, and form a most it. In General, do not understand how to force the parser to use the search on the site and go to the desired section.
April 3rd 20 at 18:40
1 answer
April 3rd 20 at 18:42
Solution
If you look closely, there is a function is invoked
searchVIN function() {
 var vin = $('input#search-vin').val()
 if (vin.length == 0) {
 alert('Not specified VIN of the car')
$('input#search-vin').focus()
return
}

 if ((vin.length != 7) && (vin.length != 17)) {
 alert('Wrong length of VIN of the car. Must be 7 or 17 characters')
$('input#search-vin').focus()
return
}

 $('input#search-vin').attr('disabled', 'disabled')
$.post(
'/ajax_vin_bmw.php',
{
 'vin': vin
},
 function (s) {
 if (s.substr(0,1) == '/') {
 document.location.href = s
 } else {
alert(s)
$('input#search-vin').removeAttr('disabled')
}
}
)
}

ie you also korlam send a post request to /ajax_vin_bmw.php with contents vin=Toibin , receive the response and parse as usual
Did not expect such an immediate and appropriate response. Thank you! Apparently this is what you need :) - Kenya_McDermott commented on April 3rd 20 at 18:45
@Kenya_McDermott, and by the way, do not have a post request, and het is
https://www.bmwcats.com/ajax_vin_bmw.php?vin=123
https://www.bmwcats.com/ajax_vin_bmw.php?vin=1231231
there returns the url where you want to go, like this
$vin_url = file_get_contents('https://www.bmwcats.com/ajax_vin_bmw.php?vin=1231231');
$content = file_get_contents('https://www.bmwcats.com' . $vin_url);
- Hellen.Herman commented on April 3rd 20 at 18:48
You've certainly made my life easier, thanks again) - Kenya_McDermott commented on April 3rd 20 at 18:51

Find more questions by tags JavaScriptParsing