benjaminbeazy Posted February 1, 2008 Share Posted February 1, 2008 Hello all, I'm trying to incorporate oscommerce into a site and want to include its login form, shopping cart, and a few other features directly into the site. Is it possible to include the outputted file, i.e. after it has been parsed. I can't seem to include the file without php attempting to parse it inside my script. I can load any URL outside the domain as such but when I try... include('http://domain.com/include_file.php'); I get... Warning: main(http://domain.com/site/modules/oscommerce/login.php): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /var/www/vhosts/domain.com/httpdocs/site/includes/community.php on line 12 Warning: main(): Failed opening 'http://inkaddict.com/site/modules/oscommerce/login.php' for inclusion (include_path='.:') in /var/www/vhosts/domain.com/httpdocs/site/includes/community.php on line 12 Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/88946-solved-including-file-output/ Share on other sites More sharing options...
kts Posted February 1, 2008 Share Posted February 1, 2008 It might not let you include it with a http:// url... did you try the root url? Quote Link to comment https://forums.phpfreaks.com/topic/88946-solved-including-file-output/#findComment-455563 Share on other sites More sharing options...
avo Posted February 1, 2008 Share Posted February 1, 2008 Hi That should work just fine silly question but you sure the url is correct ? Cheers. Quote Link to comment https://forums.phpfreaks.com/topic/88946-solved-including-file-output/#findComment-455565 Share on other sites More sharing options...
benjaminbeazy Posted February 1, 2008 Author Share Posted February 1, 2008 If I just take off the http://, it says not found. If I try the relative path to the file, it attempts to parse the file inside my script, which dies because of the different script paths (the include file includes many of its own files relatively). I would like it to include the output of the file. I'm absolutely sure the path is correct. Quote Link to comment https://forums.phpfreaks.com/topic/88946-solved-including-file-output/#findComment-455567 Share on other sites More sharing options...
rhodesa Posted February 1, 2008 Share Posted February 1, 2008 one way around it, is to make all the paths in the included file absolute. this is easy to accomplish like so: include_file.php <?php $mydir = dirname(__FILE__).'/'; //Get the directory that include_file.php is in inlcude($mydir.'relativefile.php'); ... ?> understand? Quote Link to comment https://forums.phpfreaks.com/topic/88946-solved-including-file-output/#findComment-455570 Share on other sites More sharing options...
benjaminbeazy Posted February 1, 2008 Author Share Posted February 1, 2008 yeah, but I'm trying to include the oscommerce login, and want to do the same with a few oscommerce modules. the web of includes and relative filepath associations is horrendous. however... i got it working. i changed it to... include('http://WWW.domain.com/include_file.php'); and it works. u can access the file just fine without www and there's no alias setup to redirect traffic to www. weird huh? Quote Link to comment https://forums.phpfreaks.com/topic/88946-solved-including-file-output/#findComment-455572 Share on other sites More sharing options...
avo Posted February 1, 2008 Share Posted February 1, 2008 sorry my mistake i get where your coming from now Interesting never tried that. Try placing the page you want to execute within a IFRAME. That way it should run as if you typed the url in the address bar on your browser. Cheers. Quote Link to comment https://forums.phpfreaks.com/topic/88946-solved-including-file-output/#findComment-455574 Share on other sites More sharing options...
kts Posted February 1, 2008 Share Posted February 1, 2008 ahhhhh how obvious sorry i overlooked that, yeah some servers are more tempermental. Quote Link to comment https://forums.phpfreaks.com/topic/88946-solved-including-file-output/#findComment-455576 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.