d.shankar Posted October 6, 2007 Share Posted October 6, 2007 I need to include a php file in my code which is available in a remote site say.. http://123.54.23.123/new.php My code is here <?php include 'http://123.54.23.123/new.php'; ?> Warning: include() [function.include]: URL file-access is disabled in the server configuration in C:\wamp\www\apps\info.php on line 2 Warning: include(http://123.54.23.123/new.php) [function.include]: failed to open stream: no suitable wrapper could be found in C:\wamp\www\apps\info.php on line 2 Warning: include() [function.include]: Failed opening 'http://123.54.23.123/new.php' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\apps\info.php on line 2 Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/ Share on other sites More sharing options...
trq Posted October 6, 2007 Share Posted October 6, 2007 Exactly as it says. URL file-access is disabled in the server configuration Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/#findComment-363226 Share on other sites More sharing options...
d.shankar Posted October 6, 2007 Author Share Posted October 6, 2007 Do i have to use ? ini_set('allow_url_fopen', 'on'); Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/#findComment-363227 Share on other sites More sharing options...
d.shankar Posted October 6, 2007 Author Share Posted October 6, 2007 Exactly as it says. URL file-access is disabled in the server configuration But i am able to access that URL directly., But not from code. Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/#findComment-363233 Share on other sites More sharing options...
MadTechie Posted October 6, 2007 Share Posted October 6, 2007 allow_url_fopen boolean This option enables the URL-aware fopen wrappers that enable accessing URL object like files. Default wrappers are provided for the access of remote files using the ftp or http protocol, some extensions like zlib may register additional wrappers. Note: This setting can only be set in php.ini due to security reasons. Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/#findComment-363248 Share on other sites More sharing options...
d.shankar Posted October 6, 2007 Author Share Posted October 6, 2007 I checked the php.ini on the remote server the option is set to On only. Also i checked with my own localhost I get the same error which i previously showed. <?php include 'http://localhost/myfile.php'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/#findComment-363337 Share on other sites More sharing options...
MadTechie Posted October 6, 2007 Share Posted October 6, 2007 if allow_url_fopen is on then you need to check allow_url_include Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/#findComment-363343 Share on other sites More sharing options...
d.shankar Posted October 6, 2007 Author Share Posted October 6, 2007 Yea i added that too MT allow_url_include=On The error was vanquished but the contents of that file is not being fetched. ??? Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/#findComment-363345 Share on other sites More sharing options...
MadTechie Posted October 6, 2007 Share Posted October 6, 2007 has to be a problem in the code then.. Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/#findComment-363349 Share on other sites More sharing options...
d.shankar Posted October 6, 2007 Author Share Posted October 6, 2007 Oh .. Then how it works if i put in this manner <?php include 'myfile.php'; ?> I dont know whats the problem ? Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/#findComment-363351 Share on other sites More sharing options...
MasterACE14 Posted October 6, 2007 Share Posted October 6, 2007 thats probably your problem right their, if the file your including has nothing in it, say maybe it has a couple variables or something, without printing them, then nothing will be displayed. EDIT: on second thoughts, is that the only PHP code you got on your page? <?php include 'myfile.php'; ?> or is their more? Regards ACE Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/#findComment-363362 Share on other sites More sharing options...
d.shankar Posted October 6, 2007 Author Share Posted October 6, 2007 Ok guys i will clearly provide the info Actually this consist of two files n1.php(the file to be included) & n2.php I need to detect an SQL Injection pattern i.e. If the user enters ' then an alert will be displayed It perfectly works when i just use include("n1.php") in n2.php , but matters get worse when i include along with localhost , i hope it is gettiing included but the alert is not displayed. n1.php <?php $pat1="/(?:^.?'$)|(?:.*(?:#|--)[^\w\s]*$)|(?:^.*\\'.+(?<!\\)')|(??:^['\\]*(?:[\d']+|[^']+'))+\s*(?:AND|OR|XOR|NAND|NOT|\|\||\&\&)[\s+]*[\d'[+&!-@])|(?:\^')|(?:^[\w\s-']+(?<=AND|OR|XOR|NAND|NOT|\|\||\&\&)\w+\()/"; $sub1='Detected classic SQL injection probings'; $pattern=array($pat1); $subject=array($sub1); foreach($_REQUEST as $key => $value) { //echo "The Key".$key; //echo "<br>"; //echo "The Value ".$value; for($x=0;$x<count($pattern);$x++) { if(preg_match($pattern[$x],$value)) { echo $subject[$x]; echo "<br>"; } else { } } } ?> n2.php <?php include("n1.php");//This works include("http://localhost/test/t1/n1.php");//This does not work ?> <html> <body> <form action=''> <input type='text' name='txt1'> <input type='submit' name='sub1'> </form> </body> </html> <?php ?> Inorder to chk the code pls try giving the input ' (single quote) Thanks a lot. Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/#findComment-363445 Share on other sites More sharing options...
d.shankar Posted October 6, 2007 Author Share Posted October 6, 2007 Bump 1 Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/#findComment-363512 Share on other sites More sharing options...
d.shankar Posted October 6, 2007 Author Share Posted October 6, 2007 Any help ? Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/#findComment-363543 Share on other sites More sharing options...
d.shankar Posted October 6, 2007 Author Share Posted October 6, 2007 ??? ??? ??? ??? Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/#findComment-363551 Share on other sites More sharing options...
darkfreaks Posted October 6, 2007 Share Posted October 6, 2007 thats because your testing it on localhost not a actual domain. if it were a domain the full path would work Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/#findComment-363556 Share on other sites More sharing options...
d.shankar Posted October 7, 2007 Author Share Posted October 7, 2007 I am using WAMP Server. I used the option "Put Online" and checked like this still it didnt work <?php include("http://192.168.1.15/test/t1/n1.php");//Still didnt work ?> <html> <body> <form action=''> <input type='text' name='txt1'> <input type='submit' name='sub1'> </form> </body> </html> <?php ?> I am afraid that it wont work online bud. Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/#findComment-363821 Share on other sites More sharing options...
MadTechie Posted October 7, 2007 Share Posted October 7, 2007 probably because very few sites support remote include Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/#findComment-363897 Share on other sites More sharing options...
d.shankar Posted October 7, 2007 Author Share Posted October 7, 2007 Yep i am in grave trouble !!! I wrote a simple code for checking out the remote include from my localhost. It works !! t1.php <?php $var="I am here"; echo $var; ?> t2.php <?php include("http://localhost/test/t1.php"); ?> The above code works !! But the code i previously posted is not workin, Please guide me. Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/#findComment-363909 Share on other sites More sharing options...
d.shankar Posted October 7, 2007 Author Share Posted October 7, 2007 Any Help Would Be Greatly Appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/#findComment-363978 Share on other sites More sharing options...
yzerman Posted October 7, 2007 Share Posted October 7, 2007 do you have permission from the site you are trying to include a file from? Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/#findComment-363979 Share on other sites More sharing options...
d.shankar Posted October 7, 2007 Author Share Posted October 7, 2007 Yea yea Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/#findComment-363982 Share on other sites More sharing options...
yzerman Posted October 7, 2007 Share Posted October 7, 2007 Ok, since you have permission from the server owners - do they have THEIR php.ini file set up the same way you have yours (to allow remote includes?) Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/#findComment-363983 Share on other sites More sharing options...
d.shankar Posted October 7, 2007 Author Share Posted October 7, 2007 I am checking locally within my system dude. Instead of accessing include("file.php"); i am trying it as include("http://localhost/file.php"); Both refers to my system only. Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/#findComment-363984 Share on other sites More sharing options...
yzerman Posted October 7, 2007 Share Posted October 7, 2007 well, if it worked with local host, but it didnt work with 192.168.2.1 (or whatever) I don't think that would be a php issue. Quote Link to comment https://forums.phpfreaks.com/topic/72083-solved-remote-include-help/#findComment-363990 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.