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); ?> Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
tommytx Posted August 8, 2010 Author Share Posted August 8, 2010 You are absolutely right.. thanks.. Quote Link to comment 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: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... Quote Link to comment 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. Quote Link to comment 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: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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.