LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 08-09-2008, 03:42 PM   #1
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 227Reputation: 227Reputation: 227
Automatic cpanel login


I am involved with a number of websites which are on free hosts. A lot of these free hosts expect a regular login to their cpanel or forum to keep the sites open.

At the moment I regularly log in to keep the sites available but sometimes miss the required login frequency and have to get the providers to reinstate the site.

This is a pain. I have thought about writing an autologin procedure (perhaps a bash script involving curl,wget or something or perhaps python) based on a cron job to automate this procedure.

Has anyone seen such a utility anywhere or any relevant information ? I cannot figure out how to get the right url for the logins.

Any information would be useful.
 
Old 08-15-2008, 12:59 PM   #2
krizzz
Member
 
Registered: Oct 2004
Location: NY
Distribution: Slackware
Posts: 198

Rep: Reputation: 30
If the login page is stuffed with some JavaScript that requires some processing on the client side in order to log in getting the proper URLs and Cookies may be severe pain in the ass. Personally I have never heard of a tool that could scrap the page and analyze the login process automatically. If you are really crazy (lazy) you could use one of the desktop automation tools to record macros and just play them when needed. I have a positive experience with the tool called "Desktop Macros" from xStarter Solutions. From what I remember it was free.
 
Old 08-17-2008, 09:05 AM   #3
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Original Poster
Rep: Reputation: 227Reputation: 227Reputation: 227
Thanks for the reply.
Quote:
If the login page is stuffed with some JavaScript that requires some processing on the client side in order to log in getting the proper URLs and Cookies may be severe pain in the ass.
Yes - this is turning into a right PITA.
 
Old 09-18-2008, 07:33 PM   #4
jinxy
LQ Newbie
 
Registered: Sep 2008
Posts: 2

Rep: Reputation: 0
I know that this is an old thread but I came upon it doing a Google search looking for the same exact script and I found what your looking for. This works great and I've tested it:

http://curl.haxx.se/mail/curlphp-2005-08/0001.html

PHP Code:
<?php 
# set up variables
$url "http://yourcpanellogin:2082/frontend/x3/index.html";
$login "cpanel";
$user_name "your user name";
$user_pass "your pass";
$agent "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1";

$ch curl_init();
curl_setopt($chCURLOPT_RETURNTRANSFER0);
curl_setopt($chCURLOPT_FOLLOWLOCATION1);
curl_setopt($chCURLOPT_UNRESTRICTED_AUTH1);
curl_setopt ($chCURLOPT_USERAGENT$agent); 
curl_setopt($chCURLOPT_URL$url);
curl_setopt($chCURLOPT_USERPWD$user_name.":".$user_pass);
curl_setopt($chCURLOPT_COOKIEJAR"my_cookies.txt");
curl_setopt($chCURLOPT_COOKIEFILE"my_cookies.txt");
curl_exec($ch);
curl_close($ch);
?>

Cheers

Last edited by jinxy; 09-18-2008 at 08:13 PM.
 
Old 09-19-2008, 01:01 PM   #5
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Original Poster
Rep: Reputation: 227Reputation: 227Reputation: 227
Wow - thanks a lot for the reply - I'll be trying it out later !!

Thanks again..
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatic login apffal Fedora 3 10-19-2006 10:05 AM
Automatic login anegbi Linux - Software 2 11-29-2005 01:57 AM
Automatic login? Cooljerk Linux - Newbie 3 09-14-2005 04:52 PM
firewall blocking cpanel login justin99 Linux - Security 3 05-28-2005 07:04 AM
Automatic Login SlavaVB Linux - General 2 03-11-2002 11:10 PM


All times are GMT -5. The time now is 12:31 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration