Page 1 of 1

Call Home Function

Posted: Mon Aug 23, 2004 2:13 pm
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.

Posted: Mon Aug 23, 2004 2:19 pm
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....

Posted: Mon Aug 23, 2004 4:10 pm
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?

Posted: Mon Aug 23, 2004 4:18 pm
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..

Posted: Mon Aug 23, 2004 5:06 pm
by Tyndie
ok thanks i will look into detecting to see if curl is available, thanks for your time and help

Posted: Wed Aug 25, 2004 10:45 am
by hedge
you could also build it yourself using fsockopen, far as I know it's always enabled.

Posted: Wed Aug 25, 2004 10:48 am
by feyd
still would have to check if it exists.. since any function can be in the disabled functions list.