SitePoint Sponsor

User Tag List

Results 1 to 14 of 14
  1. #1
    Non-Member
    Join Date
    Dec 2004
    Location
    London
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can someone give me an example?

    Can someone give me an example to show how to use a cronjob to every minute log in to cpanel and to to a web address?
    I can't find any documentation on anything even similar.

  2. #2
    Non-Member Icheb's Avatar
    Join Date
    Mar 2003
    Location
    Germany
    Posts
    1,474
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why do you want to log in to cpanel and to a website via a cronjob? You can easily wget the website, but logging in?

  3. #3
    SitePoint Addict trogdor1024's Avatar
    Join Date
    Oct 2004
    Location
    New Jersey
    Posts
    235
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, to do it you would add this line to your cron...
    Code:
    # This will run "myfile.php" every minute
    * * * * * /path/to/myfile.php
    But I would agree with Icheb in questioning why would you want to do that.

  4. #4
    Non-Member
    Join Date
    Dec 2004
    Location
    London
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I want to do this because there is functionality in cpanel that I would like to enable visitors to use, but it wouldn't be very good for them to be able to log into cpanel on their own- that would be just plain stupid, as a matter of fact.

  5. #5
    Non-Member Icheb's Avatar
    Join Date
    Mar 2003
    Location
    Germany
    Posts
    1,474
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can't accomplish this with a cronjob. You would have to check the documentation if there is a way to let other people use a stripped down version of cpanel of some sorts.

  6. #6
    Non-Member
    Join Date
    Dec 2004
    Location
    London
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Icheb
    You can't accomplish this with a cronjob. You would have to check the documentation if there is a way to let other people use a stripped down version of cpanel of some sorts.
    Actually, I've set everything up except for logging in, which I need to do manually. I have a method that should work.
    Does anyone know how to log in to cpanel through a php script, or can't you?

  7. #7
    Non-Member
    Join Date
    Dec 2004
    Location
    London
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So I'm assuming that there is no way to log in to cpanel through php?

  8. #8
    Non-Member bronze trophy geniusgoalie's Avatar
    Join Date
    Sep 2004
    Location
    Buffalo, USA
    Posts
    979
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not positive, but I think that's what they're getting at
    Someone might prove me wrong though, they usually do

  9. #9
    Non-Member Icheb's Avatar
    Join Date
    Mar 2003
    Location
    Germany
    Posts
    1,474
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Now that I think of it, you can probably fake the request with the curl library.

  10. #10
    Non-Member
    Join Date
    Dec 2004
    Location
    London
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Icheb
    Now that I think of it, you can probably fake the request with the curl library.
    Can you please give me a link?

  11. #11
    Non-Member
    Join Date
    Dec 2004
    Location
    London
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I thought I could do somethin like this:
    PHP Code:
    <?php
                         
    $ftp_server 
    "ftp.example.com";
    $ftp_user "foo";
    $ftp_pass "bar";

    // set up a connection or die
    $conn_id ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server"); 

    // try to login
    if (@ftp_login($conn_id$ftp_user$ftp_pass)) {
       echo 
    "Connected as $ftp_user@$ftp_server\n";
    } else {
       echo 
    "Couldn't connect as $ftp_user\n";
    }

    // close the connection
    ftp_close($conn_id);  
    ?>
    But I guess not, because it isn't ftp.

  12. #12
    Non-Member Icheb's Avatar
    Join Date
    Mar 2003
    Location
    Germany
    Posts
    1,474
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  13. #13
    Non-Member bronze trophy geniusgoalie's Avatar
    Join Date
    Sep 2004
    Location
    Buffalo, USA
    Posts
    979
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    wait, I just had an idea. If your cron is cpanel powered, you will be able to access functions from cpanel without logging in, because it would all be from localhost. That actually gives me a really good idea...

  14. #14
    Non-Member
    Join Date
    Dec 2004
    Location
    London
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oohhh, you're right! Thanks a lot gg!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •