hello, i wanna include php file in one script of mine from another server without getting bugs in my script. so the way that i have been trying to use is include("http://site.com/path/file.php"); but i got this error... Warning: include() [function.include]: URL file-access is disabled in the server configuration... PHP: the reason of this error is disabling include function for the urls....this include(); function default status is off in all the servers for the urls include, beside it cause xss bug when i use it for urls including .. and that makes me unable to use this function for urls include. so now i have this file url in another server, inside this file some important functions that i need to run into my script, i can't download the file so i have to include it from its server by its url...so please guys any body knows any good way to do this ???
Yes, you can't include script from another server. You'll have to write some Web Service (SOAP, etc.).
shockworks is right. You cannot include files from other servers. You might want to have that other script output things, you can read them from your server. It usually helps when you provide some context, e.g. what exactly you are trying to do in general and why you cannot download the file from the other server.
i can include the file from the other server by using include("http://site.com/path/file.php"); , but i have to edit my php,.ini first with setting allow_url_fopen = On ... but that will open xxs bug in my script as i said previously .. about what iam trying to do and why i can't download the file...well, just inside that file some important functions that i can't put in the same place with the script in the same server, and that is why i upload the file in other server and i include it inside the script... so please any better idea could help me to do that ???
a) You can't include php file from server A (where is source file stored) and call functions from script. If you set allow_url_fopen, you can download php file, but server A will execute the file and you don't get source code - but it isn't important. b) If you need call some function from other server you must build server-client model. You can use SOAP extension or you can build URL-based solution like: call by cURL: http://important-functions-server.ltd/functions/i-m-calling-function.php?name_of_function=abc&arg1=1548&arg2=1545&user=user&pass=pass and than you'll process the response.
i don't need to get the source code from the file, and i don't need URL-based variables too... i just want to run the functions from that php file from server "A" into my script in my server "B". any way i did some more work on this thing and here is what i ended with:- 1. i can include the php file from the server "A" into my script in server "B", by using include("http://site.com/path/file.php"); and editing php.ini with setting allow_url_include = On 2. when i include the php file from another server, it works find but the functions and the classes doesn't work. 3. to get the access to the functions and the classes, i have to include the file with a different extension - such as '.inc' This way the php interpreter will not 'get in the way' and the text will be included normally.... so i have to include the file like this include("http://site.com/path/file.inc"); 4. i get huge problem by renaming the file in server "A" from 'file.php' to 'file.inc', because the server will consider it as a text and it will be viewable as a text in any browser !! so please anybody got any idea about how to get access to the functions and the classes without renaming the file extension ??? or anybody know good idea to make the file non-viewable in the browsers after renaming it to file.inc ???