tommytx Posted August 8, 2010 Share Posted August 8, 2010 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 https://forums.phpfreaks.com/topic/210101-using-http_post-to-auto-fill-and-submit-a-formautologin/ Share on other sites More sharing options...
l4nc3r Posted August 8, 2010 Share Posted August 8, 2010 Not the biggest buff on cURL, but you should be posting the form processing page (ie, the form "action"), not the form itself. Looking on the page, it looks like the url the form is posting to is http://www.handy-hanky.com/shirley/success.php, so you'd want to change the url in your curl_setopt function to that. Link to comment https://forums.phpfreaks.com/topic/210101-using-http_post-to-auto-fill-and-submit-a-formautologin/#findComment-1096498 Share on other sites More sharing options...
tommytx Posted August 8, 2010 Author Share Posted August 8, 2010 You are absolutely right.. thanks.. Link to comment https://forums.phpfreaks.com/topic/210101-using-http_post-to-auto-fill-and-submit-a-formautologin/#findComment-1096503 Share on other sites More sharing options...
tommytx Posted August 8, 2010 Author Share Posted August 8, 2010 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:[email protected] 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 https://forums.phpfreaks.com/topic/210101-using-http_post-to-auto-fill-and-submit-a-formautologin/#findComment-1096512 Share on other sites More sharing options...
Yesideez Posted August 8, 2010 Share Posted August 8, 2010 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 https://forums.phpfreaks.com/topic/210101-using-http_post-to-auto-fill-and-submit-a-formautologin/#findComment-1096531 Share on other sites More sharing options...
trq Posted August 8, 2010 Share Posted August 8, 2010 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:[email protected] 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 https://forums.phpfreaks.com/topic/210101-using-http_post-to-auto-fill-and-submit-a-formautologin/#findComment-1096537 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.