0

I understand that within same folder, I can use include() function for external PHP file, but now I would like to call the function in another PHP file which located in another URL.

For example, my live website (liveexample.com/table.php) has drop-down list and table, but without data. My another PHP file (dataexample.com/data.php) is connected to database and process to extracting data out. But, it is in another server.

I need to make my data on [dataexample.com/data.php] delivers to [liveexample.com/table.php] and let the looping to draw table with data out on [liveexample.com/table.php] page.

Anyone has idea to design this method of delivering data from another server to another by using function call in PHP?

Or any other better solution to deliver my data between two different servers such as make the data record set into array and send to [liveexample.com/table.php]?

Please give me advise or consultation. Appreciate much!

5
  • you can include files only using paths, not urls.. if you don't have the two applications on the same server you can't use the files.. if you could we all would be able to use classes from google, facebook etc.. Commented Mar 9, 2012 at 8:14
  • @mishu , any solution or suggestion? Commented Mar 9, 2012 at 8:19
  • copy the files to both servers.. if we are talking about different servers Commented Mar 9, 2012 at 8:21
  • @mishu I don't think that suggestion could be considered a valid general solution. Commented Mar 9, 2012 at 10:40
  • 1
    @RomiHalasz yes, I might have missed the idea.. I only stated (in the first place and continued without reconsidering the entire idea) that you can't just include remote files.. sure thing the answer to the entire problem is creating an api.. if it is a webservice using soap, just some files with xml/json output or a RESTful api or anything else - that's the developer's choice depending on the resource and his preferences Commented Mar 9, 2012 at 10:56

2 Answers 2

1

I think SOAP webservice would be perfect for you to attain what you want but if possible just copy the same codes you have from the separate server.

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

Comments

0

If you make [dataexample.com/data.php] output your data as XML, then you can use it as a web service. What that means is, you can take that XML output (by sending a request the the data URL), and then parse it to load the data. This way, you can use that service any way you want. One way would be like you wanted, other examples would be via AJAX, or Flash etc.

So here are a few topics worth looking into:

I hope this will give a pretty good idea of how to achieve what you want to accomplish, because there a few options you can go by. Like Cristopher said, SOAP is one of them.

Have a great day.

Comments

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.