Jump to content

Include external file in ebay listing.


QuizToon

Recommended Posts

Hi All,

 

I want to include my terms and conditions in an ebay listing.

 

The reason for this is to ease the process if and when i need to change the terms.

 

I stopped using eBay about a year ago and back then is used this code to display my terms withing the eBay lisitng.

 

<?php include ('http://www.example.com/terms.php'); ?>

 

NOw when i put that code into the listing it doesnt display.

 

I tested this out on my own server and it didnt display there either so I now it isnt eBay.

 

I also tried emoving the brackets without success.

 

The only way I can get it to display as include on my server is to use a relative path, which isnt the result I need

 

Has something changed in the past year?

 

Is there another way to display an external file using an absolute path to an external file?

 

Many Thanks

 

 

Link to comment
Share on other sites

I've never used a URL with include.  Appears to work provided you have the appropriate wrappers.  That being said, I would highly recommend not doing so, and store it locally, or use curl if it really needs to be remote.  I would be interested in other opinions.

Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /var/www/main/html/testing/include.php on line 2

Warning: include(http://php.net/manual/en/function.include.php): failed to open stream: no suitable wrapper could be found in /var/www/main/html/testing/include.php on line 2

Warning: include(): Failed opening 'http://php.net/manual/en/function.include.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/main/html/testing/include.php on line 2
Link to comment
Share on other sites

If ebay ever let you add that into a listing they were messing up, usually sites only allow html and some javascript in posts.

 

http://pages.ebay.com/help/policies/listing-javascript.html

 

 

 

As for your own site, assumes the local path within own server

<?php include('terms.php'); ?>

You can use the servers document root as well

<?php
include($_SERVER['DOCUMENT_ROOT']."terms.php");
?>

dirname is another way

<?php
include(dirname(__FILE__) . 'terms.php');
?>

I like to do it this way to deal with the separators

<?php
include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'terms.php')
?>

including external sites

 

file_get_contents

<?php
$terms = file_get_contents('http://www.example.com/terms.php');
echo $terms;
?>

curl as NotionCommotion mentioned

 

iframe it and do the sizing

<iframe src="http://www.example.com/terms.php"></iframe>
Link to comment
Share on other sites

 

including external sites

 

file_get_contents

curl as NotionCommotion mentioned

iframe it and do the sizing

 

 

Another option is include() per http://php.net/manual/en/function.include.php.  Bad idea?

 

 

If "URL include wrappers" are enabled in PHP, you can specify the file to be included using a URL (via HTTP or other supported wrapper - see Supported Protocols and Wrappers for a list of protocols) instead of a local pathname. If the target server interprets the target file as PHP code, variables may be passed to the included file using a URL request string as used with HTTP GET. This is not strictly speaking the same thing as including the file and having it inherit the parent file's variable scope; the script is actually being run on the remote server and the result is then being included into the local script.

 

 

I would expect file_get_contents() is typically the best choice.

Link to comment
Share on other sites

I would expect file_get_contents() is typically the best choice.

Not really, curl would be more bulletproof as it will work no matter what. file_get_contents() relies on certain fopen wrappers being enabled, which may vary from server to server.

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.