You are here: Re: How to get url of current url from included script on different server « PHP Programming Language « IT news, forums, messages
Re: How to get url of current url from included script on different server

Posted by Justin Koivisto on 01/10/06 19:56

Oli Filth wrote:
> Justin Koivisto said the following on 10/01/2006 14:57:
>
>> Oli Filth wrote:
>>
>>> include("http://remote.server.example.com/script.php?host=http://local.example.com/mainscript.php");
>>
>> Out of curiosity, does the $_GET array actually get populated with
>> values sent in this way for the remote script?
>
> Yes. The receiving remote server doesn't care (or know) where the HTTP
> request for script.php came from, so it acts exactly as if someone had
> requested that URL from their browser.

I'll have to keep that in mind next time I consider using curl for a
simple get request...

>> I know that if you do something like:
>> include 'myfile.php?var=val1';
>>
>> That php looks for a file with that exact name (which will not exist in
>> most cases). Therefore in order to make that work (locally anyway),
>> you'd need to set the variable before the file was included.
>
> Well yes, because "?var=var1" is meaningless in a local filesystem.
> Setting the local variable works because both scripts are being run
> locally in the same PHP instance.

That's what I was trying to explain. When I first started php (many
years ago), I learned that while experimenting with different things.
One of these days I'll get my site together that I plan to use for
articles and such like that. ;)

--
Justin Koivisto, ZCE - justin@koivi.com
http://koivi.com

 

Navigation:

[Reply to this 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

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