1

I want to get value from the ASP form, but all my attempts fail. It is a form on the website here: https://www.dovera.sk/overenia/dlznici/zoznam-dlznikov

For example I try this value 36471224 and form (on this site) return values. I am trying to get the CURL request, but I have not succeeded yet. Is it at all possible (I'm desperate)? I will be very glad if at least somebody is navigating me in the right way. Sorry for stupid question.

1 Answer 1

1

You can use google developer tool to get the curl request

cURL request google developer

Assuming that the variables doesn't change and effect , you can come to the above solution

Solution:

<?php
function fetch_value($str, $find_start = '', $find_end = '')
{
    if ($find_start == '')
    {
        return '';
    }
    $start = strpos($str, $find_start);
    if ($start === false)
    {
        return '';
    }
    $length = strlen($find_start);
    $substr = substr($str, $start + $length);
    if ($find_end == '')
    {
        return $substr;
    }
    $end = strpos($substr, $find_end);
    if ($end === false)
    {
        return $substr;
    }
    return substr($substr, 0, $end);
}

$post_page = "https://ep.dovera.sk/PublicZone/Neplatici/NeplaticiWeb.aspx";
$search_term = "36471224";

$ch = curl_init();
curl_setopt($ch, CURLOPT_REFERER, $post_page);
curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7)');
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');



$post_string = 'ctl00%24Main%24GlobalScriptManager=ctl00%24Main%24PageUpdatePanel%7Cctl00%24Main%24btnSearch&__EVENTTARGET=ctl00%24Main%24btnSearch&__EVENTARGUMENT=&__VIEWSTATE=DNsB8hM9wz%2FW6xBtn%2FZkhbF6O476J2gngpFKhZ69zbFcSWgUS1mBE0yhm%2BN2G2rYrkyri%2FJdB5zLpoULSuhZCa7%2FJLp6gFVRLeIddMXOUbjS5vvl8sLtVZLZRWA4f8xPTP%2BvklzJvMk1AHGEPuWTL5CkWIzK4j4iNMEWiAw36Dikxs9fW7U7tkbrAwKLwnd%2BRNbaYUV%2FXG74uKswnRCcp6UChwpQb%2FruBXB4F3O1i04y3wLn1je0SS%2BW6NqRtuPUog3eHChPM%2FzrRW9Uap8qHIBKbKWvUZZalTYQBImPMLo7MMn2e5MyeJlBHBvs27mgM3l0%2F9upFZXTYz0Qf6P0WwDsn8zGQgvUgsyU82%2BxOO4o9KPx0CoDj4970zOBTnTY%2B4M8LrYhkaRSAPe0iUFbVbN8YaaIaL55XDgSvC%2FCI22Jqu%2FmGWGi9JVDV11nKJavwGmZDqEk2npf2cuu99sjex0%2B8hXeUSzPNKhpyVgJcNs6dGM%2Bas0ezeVcc8fmue1jiwhVBM6mKaapdOBSI%2FXOjIj%2FCvP3cC9%2FR4J%2FBpqxwPk%3D&__VIEWSTATEGENERATOR=BD62B0C4&__VIEWSTATEENCRYPTED=&__EVENTVALIDATION=cJqi2bjVZY21%2FUyBXt2IDjfqX7O%2B7rlSpeoBTVDLlEo2NS0H7I6q55OoYLV0mgze9JUnEv4x9YlnWxxe5F%2BmR4NAd%2FrohDoYiaOFlVboUhIeJhFIACbORPQRemXeo9CwTQRCEPZ5ZKcixnFvdfFORoNB744G5BEsHON1MyGvF1sic5O2W6RYSxRfM2yslzXrwcBUPsT2mryIEHinE7awsBjCnFJIV%2BfknQq0zVjeHS0BobfJolodHqPkcXDVgurT&ctl00%24Main%24hdLinkNewWindow=&ctl00%24Main%24hdLinkTarget=&ctl00%24Main%24hdXVal=0&ctl00%24Main%24txtSearch='.$search_term.'&ctl00%24Main%24hdwatermark=Zadajte%20meno%20a%20priezvisko%2C%20rodn%C3%A9%20%C4%8D%C3%ADslo%2C%20obchodn%C3%BD%20n%C3%A1zov%20alebo%20I%C4%8CO&recaptcha_challenge_field=03AJIzXZ6kCvOklH6XGTrILEvfL1K6CWph19yWrUyh2B9QdBxFh9LJJ-mN4K2KwUGpDBKN6UCBJ9VuFguJEtMYoB8_2ZjQWnunD3wH_LLuojbCzbzJ1RRyJiq58zbfynXLaKJbAlUcoarElCRfN7VC9xv1V8rfWZCPoiCa2YVDi6ZPqJ2KCDFp6PHXQO96nR-0-7XSS5Y329sX&recaptcha_response_field=&__ASYNCPOST=true&';

curl_setopt($ch, CURLOPT_URL, $post_page);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);

$content = curl_exec($ch);
curl_close($ch);

$name = fetch_value($content, '<span id="Main_gwNeplatici_lblNazov_0">', '</span>');
$address = fetch_value($content, '<span id="Main_gwNeplatici_lblAdresa_0">', '</span>');
$ico  = fetch_value($content, '<span id="Main_gwNeplatici_lblICO_0">', '</span>');
$amount  = fetch_value($content, '<span id="Main_gwNeplatici_lblSuma_0" style="font-weight:bold;">', '</span>');
echo 'Name : '.$name.'<br>Address :'.$address.'<br> Ico : '.$ico.'<br>Amount : '.$amount ;



?>

Result :

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

uff, this is not the answer. this is the solution! thank you very much for your help. I owe you a beer :)
Mark it as a solution ;) and let's take this beer :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.