FIREBALL5 Posted September 15, 2008 Share Posted September 15, 2008 Is it possible to get information from other scripts without using require() or include()? For example, I have a script called test1.php. It has a parameter "i=1" (test1.php?i=1). This script returns a value specific to this particular parameter. Now, in another script called test2.php, can I somehow get the value that test1.php?i=1 returns in the test2.php script? If my example needs to be clarified any, let me know. Thanks guys! Quote Link to comment Share on other sites More sharing options...
Bendude14 Posted September 15, 2008 Share Posted September 15, 2008 using ajax you can retrieve values from other scripts fairly easy, you might want to look into that Quote Link to comment Share on other sites More sharing options...
FIREBALL5 Posted September 15, 2008 Author Share Posted September 15, 2008 Is there any way that I can do it with just PHP? Quote Link to comment Share on other sites More sharing options...
genericnumber1 Posted September 15, 2008 Share Posted September 15, 2008 if the file is available by http, you could attempt using file_get_contents('http://www.mydomain.com/test1.php?i=1'); If not... it's a bit more difficult. Quote Link to comment Share on other sites More sharing options...
Bendude14 Posted September 15, 2008 Share Posted September 15, 2008 well you could add some code to page 1 so once it evaluated using the param i=1 it would then pass the info back to page2 like so header("Location: page2.php?i=2"); if this is not what you want try explain more what you are trying to achieve Quote Link to comment Share on other sites More sharing options...
genericnumber1 Posted September 15, 2008 Share Posted September 15, 2008 I should add that I'd advise handling the problem differently, there's almost certainly a better way of fixing your problem than doing what you are describing. Quote Link to comment Share on other sites More sharing options...
FIREBALL5 Posted September 15, 2008 Author Share Posted September 15, 2008 Alright. New example, new explanation. Script 1: Hi, need some information from you regarding _. Here is the data that will need to fetch me the data: _ Script 2: Thank you for the data. Here is your information: _ Script 1: Thank you for the information. (Now is when I want to embed the information that Script 2 gave Script 1) <Script 1 uses and displays the information. The End.> Lol, does that help? Quote Link to comment Share on other sites More sharing options...
genericnumber1 Posted September 15, 2008 Share Posted September 15, 2008 I would just advise turning "script 2" into a function and pass it as a param... if you insist on doing it as you say using GET, then address it via http as I showed in my last post. 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.