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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.