Jump to content

[SOLVED] including file output


benjaminbeazy

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/88946-solved-including-file-output/
Share on other sites

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. :)

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?

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.