Reply to Re: Including a .php file from another server?

Your name:

Reply:


Posted by hntgzr on 09/25/05 11:20

"Gordon Burditt" <gordonb.2h4eq@burditt.org> wrote in message
news:11jc2fh2a2ovc1@corp.supernews.com...
> >I am trying to include a function in a .php file on a different server
> >from
>>the main .php files.
>
> When you fetch a PHP file from a remote server, that server processes it
> and sends out the OUTPUT (not the PHP code) from the file. I don't
> know how Apache on the server you are trying to fetch from deals
> with .inc files as opposed to .php files.
>
> Here's an idea: why don't you COPY phpfiletocall.inc to the local
> server and use it there?
>
>>include_path=http://www.anotherserver.com/foldername;
>>include(http://www.anotherserver.com/foldername/phpfiletocall.inc);
>>
>>The .inc file is php formatted. Variables are passed to it (not via GET
>>or
>>POST though) and returned using return(variablenames, etc);
>
> If you were expecting to *RUN* phpfiletocall.inc on www.anotherserver.com,
> how do you pass variables to it by other than via $_GET or $_POST?
>
>>But for some reason it doesn't appear to work properly.
>>
>>Am I correct in using the .inc extension?
>>Are the commands above correctly written?
>>
>>Basically I am trying to use the fsockopen function in a .php file on
>>another server where I know it works and return the results to a server
>>where the fsockopen command doesn't work.
>
> If you are using 'include', you are fetching code from a server
> where fsockopen will work (but you're not running it there) and
> attempting to use it on a server where it won't work (but that's
> where you're trying to make it work), if I understand your problem
> correctly.
>
> Gordon L. Burditt

Thanks for the reply.

Yup, you understand my problem correctly :)

I am trying to run code on a server where fsockopen does work from the sites
local server where fsockopen doesn't work.

The code located on the remote server (i think that's the correct
terminology) is:

[This is the announce-connectable.inc file]
---------

<?

$sockres = @fsockopen($ip, $port, $errno, $errstr, 8);

if (!$sockres)
{
$connectable = "no";
// @fclose($sockres);
}

else
{
$connectable = "yes";
@fclose($sockres);
}

@return($ip, $port, $errno, $errstr);

?>

---------

The php file on the local server that's calling it is using:
include_path="http://www.anotherserver.com/folder";

include("http://www.anotherserver.com/folder/announce-connectable.inc");


Included in that file are the variables $ip and $port. $errno and $errstr
are not passed to the .inc file as they should always be null prior to be
returned.

Am I trying to do something that PHP can't do?

TIA
h

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация