/    Sign up×
Community /Pin to ProfileBookmark

include() from external hosted php file

Hi I’ve my full script hosted at SITEA. My client (SITE? wants this script but i do not want my script to be leaked to the public. Hence I intended to included the important php file (with all necessary functions), using the include() tag.

But when i tried to access site B, i got the error below. Please advice. Thx

<?php
include_once “http://SITEA.com/1/mufunc.inc.php“;
?>

[QUOTE]

Warning: include_once() [function.include-once]: URL file-access is disabled in the server configuration in /home/SITEB/public_html/1/~.php on line 4

Warning: include_once([url]http://SITEA.com/1/mufunc.inc.php[/url]) [function.include-once]: failed to open stream: no suitable wrapper could be found in /home/SITEB/public_html/1/~.php on line 4

Warning: include_once() [function.include]: Failed opening ‘http://SITEA.com/1/mufunc.inc.php‘ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/SITEB/public_html/1/~.php on line 4

[/QUOTE]

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@chazzyMar 01.2009 — set allow_url_fopen to true/on in your php.ini, restart apache and it'll work.

but note that doing an include like this sends it as HTTP traffic, and will display the rendered content, not the functions.

i think what you should consider, if your code is so top secret (btw - does doing this go against the PHP license?) is setup a web service to use your code.
Copy linkTweet thisAlerts:
@kohkindachiauthorMar 01.2009 — Thanks ? How do i edit php.ini? And is it sitaa or b do i need to enable this?

Hmm...also, will my php file be secure will do such things?
Copy linkTweet thisAlerts:
@kohkindachiauthorMar 01.2009 — set allow_url_fopen to true/on in your php.ini, restart apache and it'll work.

but note that doing an include like this sends it as HTTP traffic, and will display the rendered content, not the functions.

i think what you should consider, if your code is so top secret (btw - does doing this go against the PHP license?) is setup a web service to use your code.[/QUOTE]


It's actually not top secret, but some script that I spent lots of money on ?

"but note that doing an include like this sends it as HTTP traffic, and will display the rendered content, not the functions."

That means the function will not work?


Where can i read abt seting up web server?
Copy linkTweet thisAlerts:
@chazzyMar 01.2009 — you probably want to take a look at this

http://us.php.net/ini.core

and i have no idea what you mean by "such things." when you do an include like this:

[code=php]include "http://mysite.com/somefile.php";[/code]

It is equivalent to
[code=php]include "http://www.google.com";[/code]

which is clearly not a PHP site. you'll want to note that in these cases, include acts more like a server side include.
Copy linkTweet thisAlerts:
@NogDogMar 01.2009 — The issues are two-fold here.

  • 1. Using a URL with include() or require() will only be allowed if your PHP configuration allows accessing include files via a URL. The settings in question are allow_url_fopen and [url=http://us.php.net/manual/en/filesystem.configuration.php#ini.allow-url-include]allow_url_include[/url] (the latter only matters if using PHP5+).


  • 2. If you request a PHP file via a URL, if the host from which you are requesting the file considers it a request for a PHP file and therefore processes it through the PHP processor, all your script will receive is the HTTP output generated by that file. I.e., the source code of the file will not be inserted into the including file, only the output (if any) generated by that file. This can be worked around by giving the include file an appropriate suffix or otherwise configuring the web host where it is located in order to serve up the file contents as plain text without any processing of it.
  • ×

    Success!

    Help @kohkindachi spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.19,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...