Jump to content

[SOLVED] how to load php class from another domain?


mga_ka_php

Recommended Posts

If it's a class definition the OP is after wouldn't...

 

include 'http://www.example.com/class_script.php';

...work? Depending on the server settings of both servers of course.

Only if the remote server wasn't set up to parse php, but simply being used as a repository for php files... otherwise it would execute the php class file and return the result of that execution (quite probably a blank page)

Another possibility is for the server where the PHP class resides to have a script that reads & outputs the content of the specified PHP class.

 

e.g. include("http://www.example.com/getClass.php?class=ClassName");

 

and in getClass.php:

if(isset($_GET['class']) && $_GET['class'] == "ClassName")
echo file_get_contents("classes/ClassName.php");

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.