Call Home Function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Tyndie
Forum Newbie
Posts: 3
Joined: Mon Aug 23, 2004 2:13 pm

Call Home Function

Post by Tyndie »

Hi,


Im having trouble finding some hints on how to create a call home function to use in my php scripts and phpnuke themes.

What i want it to do, is first of all, on install is connect to my server which will have a script which will add the php server name/ip to the database, with a binary option which is for setting the allowed use of the script to on /off, definable by me in a admin panel.

This option is set to On by default, and turn off able by me, if it is a illegal usage.

Then in the php which the user will use, which is encrypted, will be a function which calls my server to see if usuage is ok or not, and if it isnt, it exits to a page saying illegal usage.

The part that I am stuck on is the call home functions, i.e do i create a function which includes a file on my server, which will connect to the db, to check that the installation is valid or not, or use some kind of socket port?

Any help will be most appreciated.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you can use [php_man]curl[/php_man] but that must be an enabled extension.. you could also use [php_man]file_get_contents[/php_man] or it's related file system functions (if fopen URL wrappers are turned on) ........ something that may work better is, lets say you have a logo you always use or something in there.. add some url attributes or something to identify the page/server/what have you, and have the image/whatever come from your server....
Tyndie
Forum Newbie
Posts: 3
Joined: Mon Aug 23, 2004 2:13 pm

Post by Tyndie »

Great thanks, I have just been finding out what curl is, and from reading a few tutorials seems like exactly what i need. But how common is curl found in webservers with php installed?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

pretty common to have hosts have it enabled by default.. it may be a good idea to check if the one of the curl functions exists, before attempting to run it.. maybe build a few alternate ways to do it, incase curl is disabled and fopen url wrappers are disabled..
Tyndie
Forum Newbie
Posts: 3
Joined: Mon Aug 23, 2004 2:13 pm

Post by Tyndie »

ok thanks i will look into detecting to see if curl is available, thanks for your time and help
hedge
Forum Contributor
Posts: 234
Joined: Fri Aug 30, 2002 10:19 am
Location: Calgary, AB, Canada

Post by hedge »

you could also build it yourself using fsockopen, far as I know it's always enabled.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

still would have to check if it exists.. since any function can be in the disabled functions list.
Post Reply