stelaras1 Posted April 9, 2008 Share Posted April 9, 2008 Hello, i need to know if it is possible to have a php file and from this php file between header and footer to have a function or something else that will call a url (that is remotely hosted) thanks a lot! Quote Link to comment https://forums.phpfreaks.com/topic/100380-load-a-url-within-php/ Share on other sites More sharing options...
flit Posted April 9, 2008 Share Posted April 9, 2008 I don't know if I understood you correctly but I think what you need are php includes. Example: <?php include("path_of_the_page.ext"); ?> Antiano bo ta?? Quote Link to comment https://forums.phpfreaks.com/topic/100380-load-a-url-within-php/#findComment-513357 Share on other sites More sharing options...
stelaras1 Posted April 10, 2008 Author Share Posted April 10, 2008 Hmm maybe you are right.. but know i get the following erros: Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/xxx/public_html/index.php on line 665 Warning: include(http://www.xxx.com/joomla/index2.php?option=xxx53) [function.include]: failed to open stream: no suitable wrapper could be found in /home/xx/public_html/index.php on line 665 Warning: include() [function.include]: Failed opening 'http://www.xxx.com/joomla/index2.php?option=xxx53 for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php:/usr/lib/php/Zend') in /home/xx/public_html/index.php on line 665 are these error related with the configuration of php.ini file? Quote Link to comment https://forums.phpfreaks.com/topic/100380-load-a-url-within-php/#findComment-513682 Share on other sites More sharing options...
gortron Posted April 10, 2008 Share Posted April 10, 2008 You might find file_get_contents(); more useful here. http://ie2.php.net/manual/en/function.file-get-contents.php Quote Link to comment https://forums.phpfreaks.com/topic/100380-load-a-url-within-php/#findComment-513700 Share on other sites More sharing options...
tinker Posted April 10, 2008 Share Posted April 10, 2008 You could also look at the cURL package (see here). However back to your original errors, (not that i've had to deal with it, but have read about it), there is a setting in php.ini which can forbid php from making external connections, you'll need to look at some php.ini specs to find out which... Quote Link to comment https://forums.phpfreaks.com/topic/100380-load-a-url-within-php/#findComment-513739 Share on other sites More sharing options...
Daniel0 Posted April 10, 2008 Share Posted April 10, 2008 Hmm maybe you are right.. but know i get the following erros: Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/xxx/public_html/index.php on line 665 Warning: include(http://www.xxx.com/joomla/index2.php?option=xxx53) [function.include]: failed to open stream: no suitable wrapper could be found in /home/xx/public_html/index.php on line 665 Warning: include() [function.include]: Failed opening 'http://www.xxx.com/joomla/index2.php?option=xxx53 for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php:/usr/lib/php/Zend') in /home/xx/public_html/index.php on line 665 are these error related with the configuration of php.ini file? Check out allow_url_fopen and allow_url_include in php.ini. Quote Link to comment https://forums.phpfreaks.com/topic/100380-load-a-url-within-php/#findComment-513740 Share on other sites More sharing options...
stelaras1 Posted April 10, 2008 Author Share Posted April 10, 2008 Daniel0 allow_url_fopen and allow_url_include variables are "enabled" in the php.ini Quote Link to comment https://forums.phpfreaks.com/topic/100380-load-a-url-within-php/#findComment-513853 Share on other sites More sharing options...
Daniel0 Posted April 10, 2008 Share Posted April 10, 2008 In that case you should be able to include and open remote files. Quote Link to comment https://forums.phpfreaks.com/topic/100380-load-a-url-within-php/#findComment-513859 Share on other sites More sharing options...
stelaras1 Posted April 10, 2008 Author Share Posted April 10, 2008 maybe there is a mistake in the syntax of the command... i 'll check it again anyway, thank you very much for your prompt repsonse Quote Link to comment https://forums.phpfreaks.com/topic/100380-load-a-url-within-php/#findComment-513862 Share on other sites More sharing options...
stelaras1 Posted April 14, 2008 Author Share Posted April 14, 2008 i've managed to use: file_get_contents() and cURL functions.. they grab the requested url and transfered it in the center of my page, but when a tried to choose a link within the requested page (that has appeared by using let's say cURL) it could not be found since the new url is trying to open in relation with the domain of my website. For instance if i request google.com and my website is www.mywebsite.com, if i try to make a search to google it cannot be loaded. Imagine that i need the functionality to be the same if i had a iframe option. What else can i do? Thank you all Quote Link to comment https://forums.phpfreaks.com/topic/100380-load-a-url-within-php/#findComment-516970 Share on other sites More sharing options...
Zhadus Posted April 14, 2008 Share Posted April 14, 2008 There is probably an easier way but you can try parsing all the links and add the full path to them. Quote Link to comment https://forums.phpfreaks.com/topic/100380-load-a-url-within-php/#findComment-516992 Share on other sites More sharing options...
stelaras1 Posted April 15, 2008 Author Share Posted April 15, 2008 i've already put the full link i.e. http://www.yahoo.com Quote Link to comment https://forums.phpfreaks.com/topic/100380-load-a-url-within-php/#findComment-517554 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.