Jump to content

Remote Includes


The Letter E

Recommended Posts

Hey people!

 

I'm currently working on an free API that i will be sharing with the web community in the next few months and had a question that much of this project hinges upon:

 

Is there a way to allow a remote include of one php file from my server?

 

Case:

I am allowing 2 ways for users to access the APi:

 

1. Using AJAX or cURL accessing a REST method over POST or GET (This part is already functional)

2. Allowing an include of the API Library

    I'm not sure if it will be completely opensource yet, only free, this is why I don't want to simply provide the source files to users.

 

Example of what I would like to do:

<?php
include('http://mysite.com/myAPI/classLib.php');
?>

 

Anybody have a solution for that??

 

 

Thanks in advance,

 

E

Link to comment
Share on other sites

including a remote file via include or require only makes a http request for the file. this means you only actually receive the output of the included file, not the functions or variables contained within it.

 

There is no way to do this without users actually downloading code that you provide..

Link to comment
Share on other sites

if your looking to maintain an updated version of this file you can put it on the server that needs to include it, then have a cron job on your server upload newer versions of the file to the remote server, so you need only update the file on your server

Link to comment
Share on other sites

if your looking to maintain an updated version of this file you can put it on the server that needs to include it, then have a cron job on your server upload newer versions of the file to the remote server, so you need only update the file on your server

 

I think you might have misread the ops question.

Link to comment
Share on other sites

including a remote file via include or require only makes a http request for the file. this means you only actually receive the output of the included file, not the functions or variables contained within it.

 

There is no way to do this without users actually downloading code that you provide..

 

That's what I thought. looks like I'll just stick to the REST Api and probably add a SOAP server later.

Thanks for the help.

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.