Posted by Greg Donald on 05/10/05 23:53
On 5/10/05, Andy Sandvik <andy@extantsolutions.com> wrote:
> im doing include('http://www.mysite.com/class.php');
> and then i create new instance but i get error - cannot instantiate
> non-existant class
> how can i get this remotely hosted class file to be defined?
If it's a PHP file sitting on a web server I doubt you will get at the
actual source using that method. Usually when you want to show the
source of a PHP file you configure the web server to show .phps files
as PHP source. For Apache a line like this works:
AddType application/x-httpd-php-source .phps
Also.. I'd just download the class file and read it from the local
file system. There's a lot of overhead in including a PHP file
remotely everytime your script runs. Even if you just cache the file
every so often it'd still be way better than a direct call every time.
I could be wrong but I doubt the class file is changing so much so
often that you need a realtime include() like that.
--
Greg Donald
Zend Certified Engineer
http://destiney.com/
[Back to original message]
|