mga_ka_php Posted October 29, 2009 Share Posted October 29, 2009 how to load php class from another domain? Quote Link to comment https://forums.phpfreaks.com/topic/179480-solved-how-to-load-php-class-from-another-domain/ Share on other sites More sharing options...
trq Posted October 29, 2009 Share Posted October 29, 2009 You can't. Quote Link to comment https://forums.phpfreaks.com/topic/179480-solved-how-to-load-php-class-from-another-domain/#findComment-946958 Share on other sites More sharing options...
Kloplop321 Posted October 29, 2009 Share Posted October 29, 2009 Plus it would add a lot of script waiting time. Quote Link to comment https://forums.phpfreaks.com/topic/179480-solved-how-to-load-php-class-from-another-domain/#findComment-946959 Share on other sites More sharing options...
cags Posted October 29, 2009 Share Posted October 29, 2009 You can't. 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. Quote Link to comment https://forums.phpfreaks.com/topic/179480-solved-how-to-load-php-class-from-another-domain/#findComment-946968 Share on other sites More sharing options...
Mark Baker Posted October 29, 2009 Share Posted October 29, 2009 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) Quote Link to comment https://forums.phpfreaks.com/topic/179480-solved-how-to-load-php-class-from-another-domain/#findComment-946978 Share on other sites More sharing options...
mga_ka_php Posted October 29, 2009 Author Share Posted October 29, 2009 i see, ok thanks Quote Link to comment https://forums.phpfreaks.com/topic/179480-solved-how-to-load-php-class-from-another-domain/#findComment-946984 Share on other sites More sharing options...
seanlim Posted October 29, 2009 Share Posted October 29, 2009 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"); Quote Link to comment https://forums.phpfreaks.com/topic/179480-solved-how-to-load-php-class-from-another-domain/#findComment-946986 Share on other sites More sharing options...
trq Posted October 29, 2009 Share Posted October 29, 2009 Even still, this just gets you the class as a string. You would need to then eval this string to actually turn it into executable code. This is far too dangerous and inefficient to bother with IMO. Quote Link to comment https://forums.phpfreaks.com/topic/179480-solved-how-to-load-php-class-from-another-domain/#findComment-947399 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.