With the help of the Curl library I send data, in response I get an error 500. That is, passed the wrong parameter or headers.
How can I check which headers and cookies are being transmitted? And what is missing?
{ $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: gstime.e-autopay.com Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Encoding:gzip, deflate, sdch Accept-Language:ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4 Cache-Control:max-age=0 Origin:https://gstime.e-autopay.com Referer:https://gstime.e-autopay.com/adminka/login Content-Type:application/x-www-form-urlencoded Connection:keep-alive'; $split = explode("\n",$request); curl_setopt ($ch, CURLOPT_HTTPHEADER,$split ); curl_setopt($ch, CURLOPT_USERAGENT, $ref); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // возвратить то что вернул сервер curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // следовать за редиректами curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 40);// таймаут4 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch,CURLOPT_COOKIEFILE,dirname(__FILE__).'/cookie.txt'); #PHP>5.3.6 dirname(__FILE__) -> __DIR__ curl_setopt($ch,CURLOPT_COOKIEJAR,dirname(__FILE__).'/cookie.txt'); #PHP>5.3.6 dirname(__FILE__) -> __DIR__ curl_setopt($ch, CURLOPT_POST, $post!==0 ); // использовать данные в post if($post) curl_setopt($ch, CURLOPT_POSTFIELDS, $post); $curl=curl_exec($ch); $data = new simple_html_dom(); $data->load($curl); $status = curl_getinfo($ch); var_dump($status); curl_close($ch); return $data; } Sending a trace. data. Cookies to the file are saved correctly.
$auth = array( 'login'=>'login', 'password'=>'password', '_token'=>$token ); echo request2($url,$auth); Who can help with this question? How else can you understand what is wrong?