2

I have a script I have made, and I am attempting to create an auto-updater. It retrieves a zip file with file_get_contents() then unzips it. I have the updater ready, but I don't want a zip file of my script just laying around on my server for anyone to download. So I have it set where only a client that has purchased this product can download it.

Is there anyway I can create a "login" form so the PHP updater script can have permission to download a WHMCS download?

I realize this is something that should be asked at whmcs.com's forums, but there is very little active support on their forums.

alexander7567
  • 665
  • 13
  • 35

1 Answers1

0

as per the "integration code" under "utilities" from the admin menu, there's this login form sample which you can use:

<form method="post" action="https://yoursite.com/clients/dologin.php">
Email Address: <input type="text" name="username" size="50" /><br />
Password: <input type="password" name="password" size="20" /><br />
<input type="submit" value="Login" />
</form>

Indeed, curl would work too:

curl -X POST "https://yoursite.com/clients/dologin.php" \
    -d "username=yourusername" \
    -d "password=yourpassword"

Note that you still need to navigate to the downloads to get it or need to know the exact location of the download to grab it. Also, for this to work, you'll need to keep up a session with your server for it to have still access to the downloads for new requests after the login has succeeded.