include a website in php file

ぐ巨炮叔叔 提交于 2019-12-12 09:45:48

问题


Hi i am trying to include a webpage link from another website into my website. how can i do this?

i tried

<?php web_include ('http://website.com/website.html') ; ?> but all the commands are not loading after this statement. I want to include another webpage into my homepage directly. my homepage is completely designed in php, but the other one is html or php.

i also tried <?php include("http://www.othersite.com/filename.html"); ?> but this html is not at all loading.

Possible Solution: ok this is what i am using

<iframe name="FRAMENAME" src="http://website.com/dropdown.html" width="1000" style="z-index:10000" height="40" frameborder="0" scrolling="no" allowautotransparency=true></iframe>

I am just including a dropdown menu for my index page. The CMS of the my site is restricting me from viewing the dorpdown in IE. When i view the dropdown.html page, i can see the dropdown, so I am trying to use iframe. Now using the iframe i can see the dropdown in IE as well, but the dropdown is not showing on the top. It is showing behind the other images on the site. How do i get it on top of the other images. z-index is not working for this.


回答1:


This code requires allow_url_include=On in your php.ini, which is disabled by default because it's a MASSIVE SECURITY RISK. This is called the Remote File Include (RFI) vulnerability. If there is PHP code on this site it will be executed on your server.

Extremely insecure:

<?php include("http://www.othersite.com/filename.html"); ?>

What you probably want is:

<?php print file_get_contents("http://www.othersite.com/filename.html"); ?>

However, this is technically an XSS vulnerability. So, if you trust the website there isn't a problem. But you probably want to run Html Purifer before printing it out.




回答2:


Just a basic recommendation, but it sounds like you're trying to debug complex functionality within a complex environment, which will only make it harder.

Debugging is easier if you break it down into component steps. In this case, I recommend:

Display the iframe on a blank html page. Make sure everything works in that simple case.

Display on the more complex page.

If it's still not working, comment out the javascript on the complex page to determine if that is causing the adverse interaction with the iframe page's javascript.

Going through the debuggging stepwise like that should simplify the process.



来源:https://stackoverflow.com/questions/3224648/include-a-website-in-php-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!