Problem with sending request with extension curl

Hello to all friends

My friends want to simulate the following request with curl extensions

POST /ajax/login/multi HTTP/1.1
Host: www.rubikachat.ir
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Referer: http://www.rubikachat.ir/
Content-Length: 63
Cookie: PHPSESSID=rvl0re3riva81b8ijbtusrndd1; testcookie=1
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

token=35&username=Admin2000&password=1&security_answer=&gender=1

And my code is as follows

<?php
$s ;= ;curl_init();
curl_setopt($s, ;CURLOPT_URL, ;"http://www.rubikachat.ir");
curl_setopt($s, ;CURLOPT_RETURNTRANSFER, ;true);
//curl_setopt($s, ;CURLOPT_NOBODY, ;true);
curl_setopt($s, ;CURLOPT_HEADER, ;true);
curl_setopt($s,CURLOPT_COOKIEFILE,'C:\wamp\www\Example\cookie.txt');
curl_setopt($s,CURLOPT_COOKIEJAR,'C:\wamp\www\Example\cookie.txt');
curl_setopt($s, ;CURLOPT_POST, ;true);
curl_setopt($s,CURLOPT_FOLLOWLOCATION,true);
curl_setopt($s,CURLOPT_MAXREDIRS,3);
curl_setopt($s,CURLOPT_TIMEOUT,5);
curl_setopt($s,CURLOPT_USERAGENT,'Mozilla/5.0 ;(Windows ;NT ;6.1; ;WOW64; ;rv:41.0) ;Gecko/20100101 ;Firefox/41.0');
$sendarray[] ;= ;"POST ;/ajax/thisregister ;HTTP/1.1";
$sendarray[] ;= ;"Host: ;www.rubikachat.ir";
$sendarray[] ;= ;"Content-Type: ;application/x-www-form-urlencoded";
$sendarray[] ;= ;"Cookie: ;PHPSESSID=mh80rddfm7dubs6n5sq1uvfai4";
$sendarray[] ;= ;"Content-Length: ;61";
curl_setopt($s, ;CURLOPT_HTTPHEADER, ;$sendarray);
//user=57926&amp;password=1&amp;username=aaatestss
$field ;= ;array('user' ;=> ;57926, ;'password' ;=> ;'1','username'=>'aaatestss100');
curl_setopt($s, ;CURLOPT_POSTFIELDS, ;$field);
$ss=curl_exec($s);
var_dump(curl_error($s));
curl_close($s);
var_dump($ss);

?>

But unfortunately I did not get a favorable result ???

Going to have to give more information than, not favorable. What does it do? What should it do?

1 Like

My request is indicated in the photo below

rrr

I need this request to create a session on a site that tells the site that it has been logged in and the user has been created with this session. Time to use the site says that it is not valid.

Sponsor our Newsletter | Privacy Policy | Terms of Service