I am trying to log in to the e-autopay website. However, I get an error of 500. I have already tried everything. Tell me, what is the error? Maybe someone can test the code. I am sure the decision is elementary.

Login and password valid

include_once('simple_html_dom.php'); function request($url,$post = 0){ $ch = curl_init(); $ref="Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.65 Safari/537.36"; curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_HEADER, 1); $request = 'Host: giggle.e-autopay.com Connection: keep-alive Cache-Control: max-age=0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Origin: https://giggle.e-autopay.com Upgrade-Insecure-Requests: 1 Content-Type: application/x-www-form-urlencoded Referer: https://giggle.e-autopay.com/adminka/login Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4'; $split = explode("\n",$request); curl_setopt ($ch, CURLOPT_HTTPHEADER,$split ); curl_setopt($ch, CURLINFO_HEADER_OUT, 1); curl_setopt($ch, CURLOPT_USERAGENT, $ref); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 400); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch,CURLOPT_COOKIEFILE,dirname(__FILE__).'/cookie.txt'); curl_setopt($ch,CURLOPT_COOKIEJAR,dirname(__FILE__).'/cookie.txt'); curl_setopt($ch, CURLOPT_POST, $post!==0 ); if($post) curl_setopt($ch, CURLOPT_POSTFIELDS, '_token='.urlencode($post).'&login='.urlencode('giggle').'&password='.urlencode('45ne6w')); $curl=curl_exec($ch); $data = new simple_html_dom(); $data->load($curl); $status = curl_getinfo($ch); var_dump($status); curl_close($ch); return $data; } $url = 'https://giggle.e-autopay.com/adminka/login'; $token = request($url,0); echo $token = $token->find('input[name=_token]',0)->value; echo request($url,$token); 
  • 500 your script gives or answer ebay? - Naumov
  • e-autopay. My script displays: ["http_code"] => int (500) - user2244523
  • so because the server gives 500 - Naumov
  • so i know it. Therefore, I ask a question. Why does a server issue 500? - user2244523

1 answer 1

How to find an elementary error in the code.

  • Enable error output up to notices by setting this option at the beginning of the script

    error_reporting(E_ALL); or in php.ini error_reporting E_ALL and display_errors 1

  • Just read error log php

  • Read the error Warning: curl_setopt() expects parameter 2 to be long, string given
  • think about her fix.
  • Go to the url in the script https://giggle.e-autopay.com/adminka/login get 500.

Conclusion: the script does not work, and the server.

  • included, read, thought, corrected, the error remains. If in the first case, without parameters, the server gives 200, then when you try to send post-data there, it gives 500. Although everything normally opens through the browser - user2244523
  • @ user2244523 everything is clear just need to first get the session to get a token and the second request is already authorized. - Naumov
  • @ user2244523 check if the file with cookies was created and the session was established. - Naumov
  • Yes, in the first case I get a token, then send it along with the login and password in the post request with the second request. A file with cookies is created. - user2244523
  • @ user2244523 must be the first token in the session to be stored i.e. if there is no session, then how much do you want to request it does not match - Naumov