Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jun 2007
    Location
    Los Angeles
    Posts
    545
    Thanks
    81
    Thanked 5 Times in 5 Posts

    Display WHM page using PHP?

    I would like to create a PHP script that displays a page in my WHM control panel (WHM is similar to cPanel). The page I'd like to display has this URL:

    http://whm_account.com:2086/scripts/showbw

    Of course just running that URL in a browser won't work because you have to be logged in. My question is: can I get logged in somehow using PHP before I run this URL to display my bandwidth page from a PHP script?

    Thanks
    RalphF
    Business Text Messaging Services
    https://www.MobileTextingService.com

  • #2
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    Quote Originally Posted by rfresh View Post
    I would like to create a PHP script that displays a page in my WHM control panel (WHM is similar to cPanel). The page I'd like to display has this URL:

    http://whm_account.com:2086/scripts/showbw

    Of course just running that URL in a browser won't work because you have to be logged in. My question is: can I get logged in somehow using PHP before I run this URL to display my bandwidth page from a PHP script?

    Thanks
    You want to take a cPanel page and make the data public? You could just create a copy of the page, edit it to remove the cPanel controls and such, and then just link to that. Or, really, I should say that you could just open up the bandwidth page's source code and copy the script that generates the bandwidth data. Then just plop that into your own bandwidth page.

    Otherwise you could cURL your own cPanel, but that just seems silly.
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

  • #3
    Regular Coder jfreak53's Avatar
    Join Date
    May 2004
    Location
    Guatemala
    Posts
    477
    Thanks
    19
    Thanked 10 Times in 10 Posts
    Go to cpanels site and read up on it's API interface. Very easy to use, years ago I made my own cPanel interface using the API for my clients when I was on a shared hosting service. WHM works the same way, just have to study it's API, WHMCS uses WHM's API very well. So there's no real need to compromise your WHM's security, better to use the API than curl.

    Go to their site, search google. And they also have their own forum with users who are WHM and cPanel experts to help you with the API.

    Now for the BW page, I don't know about WHM's page, but I know in the olden days cPanel's bandwidth programs you could make a cron job to generate it once a week or day or however then in that same cron script copy it to a web directory, I also use to do this in the very beginning, might be the same with WHM.
    "FORTRAN is not a language. It's a way of turning a multi-million dollar mainframe, into a $50 programmable scientific calculator."
    http://www.microfastcat.com -- FastCat Software, the fastest software on the NET!
    http://www.microthosting.com -- Free reseller web hosting, Hosting, VPS, FREE SMALL HOSTING!!!
    http://www.microtronix-tech.com -- Web design and programming

  • #4
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    Quote Originally Posted by jfreak53 View Post
    ...So there's no real need to compromise your WHM's security, better to use the API than curl...
    No doubt about that. I'm totally unfamiliar with these API's (I don't use either script, personally), but if they have a good way to get at it through their own built-in coding I'd do that before anything else.

    So, yeah, forget about the cURL!
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting


  •  

    Posting Permissions

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