how can i include from other server.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sandesh
Forum Newbie
Posts: 1
Joined: Mon May 03, 2010 5:05 am

how can i include from other server.

Post by sandesh »

there is one file from another server and its aspx file .. and i want to include that file in my website. So how can i do it.


include("http://www.examole.com/a.aspx?email=sadfasd");

actually i really dont want the code to get included but just want to trigger that file using php with email="SOME VALUE".
rnoack
Forum Commoner
Posts: 34
Joined: Mon May 03, 2010 12:38 am

Re: how can i include from other server.

Post by rnoack »

you can't include it, because php is running server-side meaning that if the file you want to include is on another server your program won't be able to read the source code.

If you just want to direct your page to that page, the code you want is:

Code: Select all

header ("Location: http://examole.com/a.aspx?email=sadfasd");
if you want to use a variable for email you can do that too... just get the value into something like $email and then:

Code: Select all

header ("Location: http://examole.com/a.aspx?email=$email");


If you want to run in the BACKGROUND, then you need to use AJAX.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: how can i include from other server.

Post by AbraCadaver »

If you just want to execute the file and don't care about its output, then this will work if you have the fopen wrappers enabled:

Code: Select all

file_get_contents('http://www.examole.com/a.aspx?email=sadfasd');
If not, then try using http_get().
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply