Would it be possible for a C++ program to call for a variable from a remote php script on a server? I know PHP from when I was younger, but now in college im taking c++ and I already have a script which checks for a valid license on websites I have designed via php and I was wondering if I could use the same script to make sure c++ compiled programs are also licensed?
Nothing impossible. Just issue HTTP requests for license server and parse reply. This can be implemented using raw sockets in a couple of hours, but there are a lot of network libraries around.
You want a desktop app to run a PHP code? No. The PHP script runs because a visitor requested the page. So your c++ app would have to emulate a visitor, request a page, then parse the resulting html to find the piece of data you are looking for. That is way too much work to simply determine license status. The traditional method is to store license information in a database (mySQL is free) and have either PHP or your C++ app add, delete, modify database records. There are standard c++ tools for communicating with a remote database.
I vote for accessing HTTP(s) to check license data, since allowing every customer to access database is a bad practice