QuizToon Posted January 6, 2015 Share Posted January 6, 2015 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 Quote Link to comment https://forums.phpfreaks.com/topic/293707-include-external-file-in-ebay-listing/ Share on other sites More sharing options...
NotionCommotion Posted January 6, 2015 Share Posted January 6, 2015 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 Quote Link to comment https://forums.phpfreaks.com/topic/293707-include-external-file-in-ebay-listing/#findComment-1501913 Share on other sites More sharing options...
ginerjm Posted January 6, 2015 Share Posted January 6, 2015 Perhaps you want to pose these questions to Ebay tech support to see what they changed. 1 Quote Link to comment https://forums.phpfreaks.com/topic/293707-include-external-file-in-ebay-listing/#findComment-1501914 Share on other sites More sharing options...
QuickOldCar Posted January 7, 2015 Share Posted January 7, 2015 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> Quote Link to comment https://forums.phpfreaks.com/topic/293707-include-external-file-in-ebay-listing/#findComment-1502005 Share on other sites More sharing options...
NotionCommotion Posted January 7, 2015 Share Posted January 7, 2015 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. Quote Link to comment https://forums.phpfreaks.com/topic/293707-include-external-file-in-ebay-listing/#findComment-1502048 Share on other sites More sharing options...
CroNiX Posted January 7, 2015 Share Posted January 7, 2015 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. Quote Link to comment https://forums.phpfreaks.com/topic/293707-include-external-file-in-ebay-listing/#findComment-1502068 Share on other sites More sharing options...
NotionCommotion Posted January 7, 2015 Share Posted January 7, 2015 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. Thanks and understood. But you agree using include() on a URL (even with wrappers) is likely never a good idea? Quote Link to comment https://forums.phpfreaks.com/topic/293707-include-external-file-in-ebay-listing/#findComment-1502071 Share on other sites More sharing options...
CroNiX Posted January 7, 2015 Share Posted January 7, 2015 I wouldn't, for the same reason. It requires special settings to be enabled to work on URLs. In shared hosting, you don't often have direct control of php.ini to enable/disable things. Quote Link to comment https://forums.phpfreaks.com/topic/293707-include-external-file-in-ebay-listing/#findComment-1502075 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.