Hi,
I have a script, let's say myscript.php.
In myscript.php, I want to execute an external script with its parameters, let's say:
http://www.otherserver.com/external.php?var1=a&var2=b
I have tried include() and exec() for this, but didn't work.
Is there a way to do this? Thanks for any hint!
execute an external script within a script
Moderator: General Moderators
Re: execute an external script within a script
If it didn't work you probably got an error message. If not try again withansa wrote:I have tried include() and exec() for this, but didn't work.
Code: Select all
error_reporting(E_ALL);
ini_set('display_errors', true);Which function should work with this, include() or exec()?
With exec(), I don't get any error message. The page acts as if nothing happened. With include(), I also don't get any error message. The script in the link just does not work the way I want it. Because this is an external link, I can not do any debugging.
But if I copy the link (http://www.otherserver.com/external.php?var1=a&var2=b) onto the browser and run it, it works just fine.
Wondering why...
With exec(), I don't get any error message. The page acts as if nothing happened. With include(), I also don't get any error message. The script in the link just does not work the way I want it. Because this is an external link, I can not do any debugging.
But if I copy the link (http://www.otherserver.com/external.php?var1=a&var2=b) onto the browser and run it, it works just fine.
Wondering why...
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Including a file from a remote site is highly dangerous. file_get_contents() or fsockopen(), et al should work depending on your server's settings.