Jump to content

Using HTTP_POST to auto fill and submit a form.(AutoLogin)


tommytx
 Share

Recommended Posts

Can someone help me with this.. I cannot figure out why it will not log in..  The actual url and user/pass are valid so feel free to test the live site.

 

 

<?php 
// INIT CURL 
$ch = curl_init(); 

// SET URL FOR THE POST FORM LOGIN 
curl_setopt($ch, CURLOPT_URL, 'http://www.handy-hanky.com/shirley/homesell_cron.htm'); 

// ENABLE HTTP POST 
curl_setopt ($ch, CURLOPT_POST, 1); 

// SET POST PARAMETERS : FORM VALUES FOR EACH FIELD 
curl_setopt ($ch, CURLOPT_POSTFIELDS, 'user=tom&pass=test&login_theme=cpanel'); 


curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 

// EXECUTE 1st REQUEST (FORM LOGIN) 
$store = curl_exec ($ch); 

echo "STORE = $store<br>";


// CLOSE CURL 
curl_close ($ch);  

?>

 

 

 

 

Link to comment
Share on other sites

that worked to send commands to the cron, but only after log in manually... what I am really trying to do is auto log into Cpanel so that I can set crons remotely... i used to do it with the old myuser:mypass@mydomain.com but that no longer works so I need a work around to do cpanel autolog in... via unattended PHP... can anyone point me in the right direction for automating login to cpanel.. X mode...

 

Link to comment
Share on other sites

I posted a similar topic a few days ago where my cURL script wasn't "pressing submit" for me. It was loading my script with the referer set and everything but getting it to "press submit" automatically proved to be a complete pain.

 

If your submit button has the name "sublogin" then you can try this:

curl_setopt ($ch,CURLOPT_POSTFIELDS,'user=tom&pass=test&login_theme=cpanel&sublogin=Commit');

 

If that still fails to work check the form itself in the browser and see if there are any hidden fields set.

Link to comment
Share on other sites

that worked to send commands to the cron, but only after log in manually... what I am really trying to do is auto log into Cpanel so that I can set crons remotely... i used to do it with the old myuser:mypass@mydomain.com but that no longer works so I need a work around to do cpanel autolog in... via unattended PHP... can anyone point me in the right direction for automating login to cpanel.. X mode...

 

 

Why bother logging into CPanel to set cron jobs when cron is a program on the server that can be set directly?

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.