Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7851609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:13:23+00:00 2026-06-02T19:13:23+00:00

I have been struggling for almost three days now on this task, and I

  • 0

I have been struggling for almost three days now on this task, and I guess I am missing on some basic cURL skills.

I start with:

In the F12 of IE I see 2 POSTs on the first page: (I notice the first one is getting a 302 which is supposed to be a redirect, and with cURL I only get 200)

Filling up the captcha:

on the second page (after captcha):

traffic:

This is my code (and I cannot move on with it because it doesn’t work for the early stages):

I Built a special form that submits to my own page with GET (with the cURL) which in turn is accessing the website:

$id=$_GET['id']; // getting the biznumber
$humanCode=$_GET['nobot'];

$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, "https://www.*******.******.***");


// setting some https to be able to access the website from my local computer.
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($curl, CURLOPT_CAINFO, "c:/xampp/htdocs/CAcerts/curl-ca-bundle.crt");

// I know the values for the ASPX vars like __EVENTTARGET, __EVENTARGUMENT, __VIEWSTATE are arbitrary now. I need to take care of that but I don't yet know how.

$postarr= array (
                "__EVENTTARGET"=>"",
                "__VIEWSTATE=" =>"%2FwEPDwULLTEzMzI2OTg4NDYPZBYCZg9kFgQCBA8PZBYCHgdvbmNsaWNrBQxnb1RvTWl2emFrKClkAgYPD2QWAh8ABQxnb1RvTWl2emFrKClkZM6iZZ0Qaf2CpfXoJJdZ0IqaWsDO",
                "__EVENTARGUMENT=" =>"",
                "__EVENTVALIDATION" =>"%2FwEWBQKgysLGCwL2r7SGDQLh4ri%2BAwLWws7NDwLWwpLPD%2F1HuCAFYzs2seaziWbYEXjDfigP",
                "hidUrlFileIshurim"=>"https%3A%2F,
"cod"=>"3322"
                    );

$fields_string='';
foreach($postarr as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string,'&');

curl_setopt($curl, CURLOPT_POST      ,1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $fields_string);

curl_setopt($curl, CURLOPT_TIMEOUT, 10);

curl_setopt ($curl, CURLOPT_USERAGENT, "User-Agent  Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; MAAU)");

// I made a cookie file and it seems to work
$cookiefile = "d:/cookie.txt";
curl_setopt($curl, CURLOPT_COOKIEJAR, $cookiefile); 
curl_setopt($curl, CURLOPT_COOKIEFILE, $cookiefile);

curl_setopt($curl, CURLOPT_FRESH_CONNECT , 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION  ,1);

curl_setopt($curl, CURLOPT_HEADER      ,1);  // DO NOT RETURN HTTP HEADERS
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

$temp=curl_exec($curl);
$info = curl_getinfo($curl);

$html = mb_convert_encoding($temp, 'HTML-ENTITIES', 'utf-8'); 
echo "ERRCODE: ".curl_error($curl);
echo '<br /><br />';
echo "INFO : ";
print_r($info);
echo '<br /><br />';
$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
echo "CODE: ".$httpcode;
echo '<br /><br />';
echo "CODE: ".$httpcode;
echo '<br /><br />';
echo "VARS: ".$vars;
echo '<br /><br />';
//echo $html;

curl_setopt ($curl, CURLOPT_URL, "https://www.*******.******.***");
curl_setopt($curl, CURLOPT_FRESH_CONNECT , 0);

echo "<br /><br /><b>2nd</b><br /><br />";
$temp=curl_exec($curl);
$info = curl_getinfo($curl);

$html = mb_convert_encoding($temp, 'HTML-ENTITIES', 'utf-8'); 
echo "ERRCODE: ".curl_error($curl);
echo '<br /><br />';
echo "INFO : ";
print_r($info);
echo '<br /><br />';
echo $html;

Can’t get that to even start to work. It starts with returning me a 200 OK, instead of 302, and sometimes I also get a 500.

I know the ASPX vars might actually be crucial, but if my browser can make these vars and send them to the server, can’t cURL do the same ?

Thanks for any help !!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T19:13:25+00:00Added an answer on June 2, 2026 at 7:13 pm

    Problem solved.
    It was a matter of using the correct headers.
    Following the reports from the browser, I went through all steps and the result showed up.

    I went through each step by using:

    curl_init
    curl_setopt()
    ..
    curl_setopt()
    curl_exec()
    curl_close()
    

    This way I had to manually set each request and go through the settings. It made the code longer, but much easier to understand.

    I had thoughts about the site using some javascript special code to make the site work, so I was troubled a lot by all the extra, javascript code, which turned out unnecessary.

    It was all about being alot more organized and following the correct header settings.

    Moreover, since this was an ASPX site, I had to read and memorize the VIEWSTATE and VALIDATION of the last page in each iteration. That is the first and very reason for the 500 internal error server message I used to get all the time.

    I used Firebug and LiveHttpHeaders to concolude each step.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been struggling with this for three days now and this is what
I have been struggling with this problem for a few days now and I
I have been struggling with this for several days now and I ran out
I have been struggling with this question for awhile now, and I haven't reached
I have been struggling with this for quite some time having been accustomed to
I have been struggling with the XMLReaderClass in c# for some time now and
I have been struggling with this for a while, so I hope some of
I have been struggling with that for 4 days now. I have a very
I have been struggling with this for days. This works, but does not pass
I have been struggling with getting this query right for hours now. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.