hackalive Posted May 31, 2010 Share Posted May 31, 2010 Hello I keep getting a Fatal error: Call to undefined function for NO real reason allow url includes is on, and I get the function trough a require_once, the file being called by require_once if I echo something from it it appears on the page, only the functions even a blank function foo(){}; wont work grrrrrrrrrrrrrrr any ideas? thanks in advance Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted May 31, 2010 Share Posted May 31, 2010 Please post the whole error message and the code it refers to. Without this we can't help you. Quote Link to comment Share on other sites More sharing options...
hackalive Posted May 31, 2010 Author Share Posted May 31, 2010 index.php require_once('http://10.0.0.1/validate.php'); foo(); validate.php function foo(){ } and yes I need it to call via url becuase eventually they will be on two different servers so it would be more like index.php require_once('http://myserver.com/validate.php'); foo(); error is tal error: Call to undefined function foo() in C:\inetpub\mysite\index.php on line 03 Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted May 31, 2010 Share Posted May 31, 2010 When you use a URL in a require or include, the PHP is executed and the results are included in your script. This is usually not what you want. Just use the plain file name <?php require_once('validate.php'); ?> Ken Quote Link to comment Share on other sites More sharing options...
hackalive Posted May 31, 2010 Author Share Posted May 31, 2010 Hi Ken, thanks but as my prevoius post said and yes I need it to call via url becuase eventually they will be on two different servers so it would be more like Quote Link to comment Share on other sites More sharing options...
hackalive Posted May 31, 2010 Author Share Posted May 31, 2010 or any alternative solutions that will return the same result as require_once, I have tried include, include_once, require and require_once all with the same result :-( Quote Link to comment Share on other sites More sharing options...
hackalive Posted May 31, 2010 Author Share Posted May 31, 2010 if I make this validate.php echo "AA"; function foo(){ } it will echo AA when validate.php is called through the require_once, but I still get the undefined function error, this is sooooooooooo annoying. Can anyone test the code on their system to see if they get the same result? (of course you'll need to use your IP not 10.0.0.1, unless that is also you test environments IP :-)). Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted May 31, 2010 Share Posted May 31, 2010 The php code is parsed and executed when the URL is requested (the same as if you browsed to the file being include.) As you have already been told, you only receive any output from the included file. You don't receive the raw php code. Quote Link to comment Share on other sites More sharing options...
hackalive Posted May 31, 2010 Author Share Posted May 31, 2010 okay then so how can I do this to get the RAW code? so this will work? Quote Link to comment Share on other sites More sharing options...
hackalive Posted May 31, 2010 Author Share Posted May 31, 2010 index.php is now fopen("http://10.0.0.1/validate.php", "r"); foo(); with the same error still occuring Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted May 31, 2010 Share Posted May 31, 2010 Why do you want to be able to include code from a different server? Putting a URL into an include() statement takes at least 50-100 times longer to execute than including the file directly thorough the file system. Putting a URL into an include() statement also means that your site will be broken any time the site where the include file is located at is also down. Do you want your site to be slow and unnecessarily crippled? Quote Link to comment Share on other sites More sharing options...
hackalive Posted May 31, 2010 Author Share Posted May 31, 2010 It is done once, and is for license key cross checking for a particular system. Basically it checks that the license key in the DB is one that is in the global licensing DB and matches the credentials stored in the local DB (eg Name, phone etc) It cross checks, in a simple way of putting it So I really do need to be able to achieve this somehow, mainly becuase I could achieve the MySQL query in the index.php but then the global DB's mysql credentials are floating around Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted May 31, 2010 Share Posted May 31, 2010 All you need to do is pass data values back and forth. Not php code. Quote Link to comment Share on other sites More sharing options...
hackalive Posted June 1, 2010 Author Share Posted June 1, 2010 so AJAX? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.