pewee2000 Posted September 2, 2009 Share Posted September 2, 2009 Hi, I have an iframe in which I want to load an external page into. I only want to input the first half of the url in the coding. The second part of the url I want to input into the address bar i.e. address bar: www.mysite.com/myfolder/myiframepage.php?token=6IDKJH1B&source=WR (in red is the part of the url I want to pass to add on to the coded url) coded url: www.externalsite.com/externalfolder/externalfile.php? So it would end up getting the iframe page from www.externalsite.com/externalfolder/externalfile.php?token=6IDKJH1B&source=WR The whole point of this is to be able to make the content of the iframe changeable. Hope this makes sense. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/172815-solved-iframe-url-variable/ Share on other sites More sharing options...
ILMV Posted September 2, 2009 Share Posted September 2, 2009 What are you having problems with? You have nicely explained what you want, but you haven't explained what you have done so far, and what is going wrong. Quote Link to comment https://forums.phpfreaks.com/topic/172815-solved-iframe-url-variable/#findComment-910878 Share on other sites More sharing options...
pewee2000 Posted September 2, 2009 Author Share Posted September 2, 2009 Unfortunately I have no understanding of php other than what it is capable of. Im not a student or anything looking to become a php expert I just need a quick bit of help with this. I can quite easily do this in flash - combining url variable string with a set url, but seeing as I cant do anything with that result I need to use php. I understand your trying to get people to learn through their own mistakes, but anything I put would be a mistake as I'm not sure how to start. I just found this below and tried to adapt it, but I don't understand it enough to modify it correctly. Any ideas? <body> <iframe> <?php if (!isset($_GET['token']) { $token = "about"; } else { $token = $_GET['token']; } include ("http://www.mysite.com/player.pl?".$token.); ?> </iframe> </body> Quote Link to comment https://forums.phpfreaks.com/topic/172815-solved-iframe-url-variable/#findComment-910929 Share on other sites More sharing options...
pewee2000 Posted September 2, 2009 Author Share Posted September 2, 2009 I have made some progress... <body> <?php $token = $_GET['token']; $source = $_GET['source']; $playerpage = "http://www.mywebsite/myfolder/player.pl?token=".$token."&source=".$source.".php"; include $playerpage; ?> </body> Now if I change include to echo I see the full string that I want to display as content. As soon as I change it to include it throws up lots of errors. The other thing is that I don't know how to get it to work within a iframe (i'm guessing this is simple). Quote Link to comment https://forums.phpfreaks.com/topic/172815-solved-iframe-url-variable/#findComment-911076 Share on other sites More sharing options...
mikesta707 Posted September 2, 2009 Share Posted September 2, 2009 Don't use an iframe. its pointless to use an iframe if you are going to be using PHP's include function. In fact people stopped using Iframes pretty much because of the PHP include function. what error are you getting? Quote Link to comment https://forums.phpfreaks.com/topic/172815-solved-iframe-url-variable/#findComment-911080 Share on other sites More sharing options...
pewee2000 Posted September 2, 2009 Author Share Posted September 2, 2009 Warning: include() [function.include]: URL file-access is disabled in the server configuration in \\NAS35ENT\domains\m\mywebsite.com\user\htdocs\video-test\index2.php on line 21 Warning: include(http://www.externalwebsite/myfolder/player.pl?token=61DKJH1B&source=WR.php) [function.include]: failed to open stream: no suitable wrapper could be found in \\NAS35ENT\domains\m\mywebsite.com\user\htdocs\video-test\index2.php on line 21 Warning: include() [function.include]: Failed opening http://www.externalwebsite/myfolder/player.pl?token=61DKJH1B&source=WR.php' for inclusion (include_path='.;C:\php5\pear') in \\NAS35ENT\domains\m\mywebsite.com\user\htdocs\video-test\index2.php on line 21 I have masked the sites as mywebsite and externalwebsite Quote Link to comment https://forums.phpfreaks.com/topic/172815-solved-iframe-url-variable/#findComment-911084 Share on other sites More sharing options...
mikesta707 Posted September 2, 2009 Share Posted September 2, 2009 you are going to have to use relative file paths, as more than likely your allow_url_fopen setting is set to off (this setting tells whether or not full URLS are allows) This is set to off by default because of a security risk. You can read more about it here: http://www.learnphponline.com/errors/url-file-access-is-disabled-in-the-server-configuration Depending on where the file that includes you other file is, you should be able to just put the relative path. IE include("myfolder/to/my/file.ext") Quote Link to comment https://forums.phpfreaks.com/topic/172815-solved-iframe-url-variable/#findComment-911092 Share on other sites More sharing options...
pewee2000 Posted September 2, 2009 Author Share Posted September 2, 2009 The small problem I have is that I can't use a local path. The only thing I have managed to come up with is: <iframe <?php $token = $_GET['token']; $source = $_GET['source']; $playerpage = "http://www.externalwebsite/player.pl?token=".$token."&source=".$source.".php"; ?> scrolling=auto id=rf src="<?php print $playerpage ?>" frameborder=0 allowtransparency=true style="width:100%;height:100%"></iframe> This comes up with a blank iframe, but the idea is there. I'm thinking of trying to put the $playerpage into the src of the iframe instead of using include (which only allows for local files) Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/172815-solved-iframe-url-variable/#findComment-911240 Share on other sites More sharing options...
ILMV Posted September 3, 2009 Share Posted September 3, 2009 Can you post the HTML created by the browser Quote Link to comment https://forums.phpfreaks.com/topic/172815-solved-iframe-url-variable/#findComment-911480 Share on other sites More sharing options...
pewee2000 Posted September 3, 2009 Author Share Posted September 3, 2009 Silly me!! it works!! Finally. I had got the token information wrong in the address bar from the external site. So what I had posted last works with external sites in an iframe. It doesn't work with the include method. Thanks people for all your efforts in helping me achieve this. Quote Link to comment https://forums.phpfreaks.com/topic/172815-solved-iframe-url-variable/#findComment-911496 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.