Page 1 of 1

Retrieve variable from PHP file on remote server.

Posted: Tue Jul 21, 2009 11:47 pm
by flapjack
Been writing a PHP software that I am almost done with.

I need to test the licence to ensure that they only use the software on one domain.

I have everything built on both ends, but am having problems with getting a variable from the remote script to do this. I have been racking my brain for hours.

So, here is the setup. On my main domain I have a php script that checks the Db to see if the receipt number and domain are already regstered. There are three conditions

1. Receipt or URL doesn't exsist = $status = added
2. Receipt Exsists but URL doesn't match = $status = confirmed
3. Any other condition = $status = used

It works great but now I need to pull that variable from another server. I have tried an include, file_get_contents but can't seem to echo $status.

Any thoughts?

I already realize the security risks here and will be protection with ION Cube

Re: Retrieve variable from PHP file on remote server.

Posted: Wed Jul 22, 2009 7:13 pm
by flapjack
No takers?

Re: Retrieve variable from PHP file on remote server.

Posted: Thu Jul 23, 2009 12:05 am
by omniuni
Try checking your php.ini. I bet you don't have PHP allowed to open remote URL's.

Then file_get_contents() should return the contents of the remote script.

Otherwise, try using CURL*.

Good Luck!

*I originally said WGET, I corrected this after seeing Flapjack's post.

Re: Retrieve variable from PHP file on remote server.

Posted: Fri Jul 24, 2009 5:20 pm
by flapjack
It seems I will have to do a fsocket open or CURL. Any thoughts?

Re: Retrieve variable from PHP file on remote server.

Posted: Fri Jul 24, 2009 5:25 pm
by andyhoneycutt
I don't understand if you're just seeing if a file exists with the appropriate contents on their end, or what the actual setup is. I'm curious why you don't just create and issue a certificate? You could use AES encryption, or some other method of your choosing, to make sure the certificate document they have on their end has all the appropriate credentials that you could compare to your own local data set.

You could certainly just use an fopen or a file_get_contents (as previously suggested) if you were to move to a comparable scheme as the one I'm proposing.

Perhaps you could better explain your problem?

Thanks in advance,
Andy

Re: Retrieve variable from PHP file on remote server.

Posted: Fri Jul 24, 2009 6:03 pm
by omniuni
I'm an idiot. Thanks Flapjack, for the correction... I meant CURL, not WGET.