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! Link to comment https://forums.phpfreaks.com/topic/124260-getting-information-from-other-scripts/ 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 Link to comment https://forums.phpfreaks.com/topic/124260-getting-information-from-other-scripts/#findComment-641663 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? Link to comment https://forums.phpfreaks.com/topic/124260-getting-information-from-other-scripts/#findComment-641666 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. Link to comment https://forums.phpfreaks.com/topic/124260-getting-information-from-other-scripts/#findComment-641671 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 Link to comment https://forums.phpfreaks.com/topic/124260-getting-information-from-other-scripts/#findComment-641672 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. Link to comment https://forums.phpfreaks.com/topic/124260-getting-information-from-other-scripts/#findComment-641673 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? Link to comment https://forums.phpfreaks.com/topic/124260-getting-information-from-other-scripts/#findComment-641688 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. Link to comment https://forums.phpfreaks.com/topic/124260-getting-information-from-other-scripts/#findComment-641692 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.