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)
Link to comment
Share on other sites

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");

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.