Lefu Posted January 4, 2008 Share Posted January 4, 2008 hi, A)I used to call my files this way: include "http://localhost/opened/ace.php?codec=23" ;I don't use this anymore because (allow_url_include = off) disabled by the hosting company. B)So I have to use: $html = implode("","http://localhost/opened/ace.php?codec=23"); echo $html; Gives the php code like echo " hello world"; How can I get : hello world. Thanks for your positive input. Quote Link to comment https://forums.phpfreaks.com/topic/84440-calling-url-as-a-file/ Share on other sites More sharing options...
shocker-z Posted January 4, 2008 Share Posted January 4, 2008 It shouldn't do as your pulling it through http which means your webbrowser should be parsing it.. does you page work if you goto it. e.g. type in your browser: http://localhost/opened/ace.php?codec=23 Regards Liam Quote Link to comment https://forums.phpfreaks.com/topic/84440-calling-url-as-a-file/#findComment-430124 Share on other sites More sharing options...
rajivgonsalves Posted January 4, 2008 Share Posted January 4, 2008 Well that will not work using the implode command in php if you want to get the contents try using fsockopen that should work... Quote Link to comment https://forums.phpfreaks.com/topic/84440-calling-url-as-a-file/#findComment-430126 Share on other sites More sharing options...
Lefu Posted January 4, 2008 Author Share Posted January 4, 2008 I am sorry B) should have been: $html = implode("",file("http://localhost/opened/ace.php?codec=23")); echo $html; my code is stored in the db, hence I need to retrieve it this way. Quote Link to comment https://forums.phpfreaks.com/topic/84440-calling-url-as-a-file/#findComment-430145 Share on other sites More sharing options...
aschk Posted January 4, 2008 Share Posted January 4, 2008 Try file_get_contents instead. $html = file_get_contents('http://localhost/opened/ace.php?codec=23'); echo $html; Quote Link to comment https://forums.phpfreaks.com/topic/84440-calling-url-as-a-file/#findComment-430157 Share on other sites More sharing options...
rajivgonsalves Posted January 4, 2008 Share Posted January 4, 2008 Ok lets get back to where we started ? what exactly do you want to do ? Quote Link to comment https://forums.phpfreaks.com/topic/84440-calling-url-as-a-file/#findComment-430163 Share on other sites More sharing options...
Lefu Posted January 4, 2008 Author Share Posted January 4, 2008 thank you, I code in side the browser, put my code into firebird db, and now I want to retrieve that code and display the results on the browser. I am hoping that you understand where i am, the code i.e function checkbox($val) {//purpose of this function is to return the value of a checkbox if ($val){ return 1; }else{ return 0; } } echo checkbox("yes"); would give 1, since this is in the db, I want to see 1 on my browser not the actual code which produced 1. at the moment B) is giving the code not the results of it. I can use curl functions and write things in the a php file then include that file but it would be violating many laws, like response time. I believe there is a way of calling url as a file, I don't know the way. Quote Link to comment https://forums.phpfreaks.com/topic/84440-calling-url-as-a-file/#findComment-430205 Share on other sites More sharing options...
rajivgonsalves Posted January 4, 2008 Share Posted January 4, 2008 Ahh I get it actually it should not... maybe because your using localhost it is... but on a full fetched domain it should not unless your using shortags "<?" and your server is configured for "<?php" tags it will not show the source code... have you tried using file_get_contents Quote Link to comment https://forums.phpfreaks.com/topic/84440-calling-url-as-a-file/#findComment-430210 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.