Avetis Zakharyan
Avetis Zakharyan

Reputation: 887

how to use php JavaBridge without allow_url_include = On?

I am using php JavaBridge library,

the thing is, I need to include the php client library directly from server using require_once "someremoteurl.com"

For this allow_url_include should be enabled, but I am in situation where this should be avoided.

Is there anyone who did this before? Is there any workaround?

I tried downloading file real-time using fread and then including it from local, but it does not work somehow, giving some php error inside JavaBridge class... I do not see any difference though.

Upvotes: 1

Views: 653

Answers (1)

Avetis Zakharyan
Avetis Zakharyan

Reputation: 887

As suggested by Marc B, used the following code:

$remote_contents = file_get_contents($url); 
file_put_contents($local, $remote_contents);

include($local);

Didn't work on first try, but worked after adding this line before the include:

define ("JAVA_SERVLET", "/WordBridge/servlet.phpjavabridge");

Upvotes: 2

Related Questions