Jump to content
Sign in to follow this  

Pastrare sesiuni active la trimiterea datelor cu cURL

Recommended Posts

Salut, vreau sa trimit date catre un formular cu cURL dar am o problema, ca sa accesez formularul trebuie sa fiu logat iar la trimiterea datelor imi arata ca sunt delogat, de ce? Si cum as putea pastra sesiunile active atunci cand trimit datele cu cURL?(https://imgur.com/a/iWtb3LJ)


//receives string $html with html code
//returns the value of the html input with name of $name
function getInpValName($html, $name){
$html = file_get_contents('http://localhost/whmcs/clientarea.php?action=changepw');

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://localhost/whmcs/clientarea.php?action=changepw");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);

// $str = substr(str_shuffle(str_repeat("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 5)), 0, 8);
$data = array(
	'token' => "". getInpValName($html, 'token') ."",
	'existingpw' => "Pass1*",
	'newPassword1' => "Pass2*",
	'newPassword2' => "Pass2*"

curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$output = curl_exec($ch);
$info = curl_getinfo($ch);

echo '<pre>';
echo '<br />';

echo '</pre>';
echo '<br />';
echo $output;


  • Downvote 1

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...