RE: Using remote include config file and class in a local file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Why dont you try returning config variables as string from remote server.

Something like :
"http://192.XXX.XXX.XXX/getconfig.php?token=123&encoded=xxxxxxxxxxxx";

And the getconfig.php file can be like

<?php
/// validate if request is from a friendly server something like the following 2 if statements
if(!$_GET["token"] || !$_GET["encoded"])
        return;
if(md5($_GET["token"]) != $_GET["encoded"])   /// just for example. Dont use md5 it can be broken easly. Try to code your own encryption function
        return;

echo 'server="DBServer";user="username";pass="password";dbname="databaseName"';
?>

And in your requester script you should request remote address content by adding your token and encoded variables. And parse the returning string.


-----Original Message-----
From: Devendra Jadhav [mailto:devendra.in@xxxxxxxxx]
Sent: Tuesday, November 03, 2009 12:11 PM
To: Anton Heuschen
Cc: PHP General List
Subject: Re:  Using remote include config file and class in a local file

No idea about NFS on windows. But you can mount samba share in XP

On Tue, Nov 3, 2009 at 3:09 PM, Anton Heuschen <antonfh@xxxxxxxxx> wrote:

> Hmmm yes thats another way of doing it ... Im running a Ubuntu box
> ..so its quite possible (how will you mount if your on XP?)
>
>
>
> 2009/11/3 Devendra Jadhav <devendra.in@xxxxxxxxx>:
> > You can you NFS to mount remote file system on your local system.
> >
> > On Tue, Nov 3, 2009 at 2:50 PM, Anton Heuschen <antonfh@xxxxxxxxx>
> wrote:
> >>
> >> Yes your right ... realizing it ... the config file is a class I use
> >> to connect to my Database .... I want to store this config on myt
> >> hosting and then I can link to it and use it at my office, or at my PC
> >> at home....
> >>
> >> But I now realize including the php ...will just return a blank page
> >> .... so its not like doing a include(/config.php) when its local ....
> >>
> >> Anyway to do this ?
> >>
> >>
> >>
> >> 2009/11/3 Devendra Jadhav <devendra.in@xxxxxxxxx>:
> >> > You are including file from external server and you are accessing it
> via
> >> > HTTP protocol. So it will include the output of
> >> > http://200.200.1.1/Folder/Config.php and the output of that script is
> >> > nothing.
> >> >
> >> > If you want to see the output just put
> >> > http://200.200.1.1/Folder/Config.php
> >> > in browser and check.
> >> >
> >> > btw what exactly you want to achieve by including external config
> file?
> >> >
> >> > On Tue, Nov 3, 2009 at 2:05 PM, Anton Heuschen <antonfh@xxxxxxxxx>
> >> > wrote:
> >> >>
> >> >> Question is wrt to including a config file on an external server in a
> >> >> local include
> >> >>
> >> >> Lets say that on 127.0.0.1 I have test.php with
> >> >>
> >> >> include http://200.200.1.1/Folder/Config.php
> >> >>
> >> >> $obj = new RemoteClass()
> >> >>
> >> >> do stuff
> >> >>
> >> >>
> >> >> and on server 200.200.1.1 I have my Config.php file which is contains
> >> >> the class RemoteClass() { echo "test" }
> >> >>
> >> >>
> >> >>
> >> >> If I try to test it locally it says it cannot find RemoteClass ...
> >> >>
> >> >>
> >> >> How can I include/require a config (or any other php classes file) on
> >> >> my local running php script ?
> >> >>
> >> >> --
> >> >> PHP General Mailing List (http://www.php.net/)
> >> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >> >>
> >> >
> >> >
> >> >
> >> > --
> >> > Devendra Jadhav
> >> >
> >
> >
> >
> > --
> > Devendra Jadhav
> >
>



--
Devendra Jadhav



  ________________________________
Bu mesaj ve ekleri, mesajda g?nderildi?i belirtilen ki?i/ki?ilere ?zeldir ve gizlidir. Size yanl??l?kla ula?m??sa l?tfen g?nderen kisiyi bilgilendiriniz ve mesaj? sisteminizden siliniz. Mesaj ve eklerinin i?eri?i ile ilgili olarak ?irketimizin herhangi bir hukuki sorumlulu?u bulunmamaktad?r. ?irketimiz mesaj?n ve bilgilerinin size de?i?ikli?e u?rayarak veya ge? ula?mas?ndan, b?t?nl???n?n ve gizlili?inin korunamamas?ndan, vir?s i?ermesinden ve bilgisayar sisteminize verebilece?i herhangi bir zarardan sorumlu tutulamaz.

This message and attachments are confidential and intended for the individual(s) stated in this message. If you received this message in error, please immediately notify the sender and delete it from your system. Our company has no legal responsibility for the contents of the message and its attachments. Our company shall have no liability for any changes or late receiving, loss of integrity and confidentiality, viruses and any damages caused in anyway to your computer system.

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux