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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
08-09-2008, 03:42 PM
|
#1
|
|
Senior Member
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810
|
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.
|
|
|
|
08-15-2008, 12:59 PM
|
#2
|
|
Member
Registered: Oct 2004
Location: NY
Distribution: Slackware
Posts: 196
Rep:
|
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.
|
|
|
|
08-17-2008, 09:05 AM
|
#3
|
|
Senior Member
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810
Original Poster
|
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.
|
|
|
|
09-18-2008, 07:33 PM
|
#4
|
|
LQ Newbie
Registered: Sep 2008
Posts: 2
Rep:
|
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($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH, 1);
curl_setopt ($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, $user_name.":".$user_pass);
curl_setopt($ch, CURLOPT_COOKIEJAR, "my_cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "my_cookies.txt");
curl_exec($ch);
curl_close($ch);
?>
Cheers 
Last edited by jinxy; 09-18-2008 at 08:13 PM.
|
|
|
|
09-19-2008, 01:01 PM
|
#5
|
|
Senior Member
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810
Original Poster
|
Wow - thanks a lot for the reply - I'll be trying it out later !!
Thanks again..
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 05:05 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|