0

I need some technical help.I have a program which is only class file and this file situated at my www.classexample.com server and my file name is myfirstclass.php. I making my other php file which will use create an object of this class file and its file name is mysecondtest.php but this file is on my other server www.objecttest.com.

How will i create and object of same class ? When i am including file like include 'http://www.classexample.com/myfirstclass.php'

and creating a object i am getting an error (class is not defined). How will i able to make an object which are situated on other server.

Any idea will be appreciate you. Thank you.

3
  • 1
    When you including like include 'http://www.classexample.com/myfirstclass.php' you do not include any files Commented Sep 4, 2010 at 10:50
  • 1
    You're telling us the file names but we don't know what's in those files... Commented Sep 4, 2010 at 10:50
  • do these 2 sites share the same server or not? Commented Sep 4, 2010 at 10:54

1 Answer 1

2

When you including like include 'http://www.classexample.com/myfirstclass.php', you do not include any files.
If you really want to use a PHP code from other domain, rename your class definition file to myfirstclass.txt
But the whole idea of cross-domain class definition seems very unusual, not to say more.
If both sites share the same server, do include files, not URLs

Sign up to request clarification or add additional context in comments.

1 Comment

I am making an api.I have a made a class which are on my server.I am giving a code which will paste in other wesbite those who are using this api.But i have to create an object for this class.I want keep this class file on myserver and want create object of this class file who will use this api.But other domain is not recognizing a this existence in the file. wht i should to do ? thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.