For months now I have been using include statements on my php pages to pull in files from my main site, these include: http://renaissancewomanonline.com/ads/announce.php http://renaissancewomanonline.com/ezines.php http://renaissancewomanonline.com/copyrightnotice.php Obviously makes it easier to make changes across several web sites. Today though suddenly the command that has been working <? include("http://renaissancewomanonline.com/copyrightnotice.php"); ?> isn't working now. The short version: <? include("copyrightnotice.php"); ?> works on the main site but the longer version doesn't work on any site that I've found. Here's an example of the horrible results: http://funtriviaonline.com Why would this happen, does anyone have an explanation and fix for me? I would be pathetically grateful! My poor allergy-befuddled brain can't think of one solution
I've had this issue happen to me before when the hosting company made a change to the firewall that denied access from the web server to all external ports. I guess they wanted to crack down on hackers gaining control of a webserver and doing nasty stuff from it. That's my first thought.
i have never used include to access a php file from an external domain. it never worked for me. coz include is supposed to include the code and u cant get the code that easy from an external domain. i dont think this long version will ever work. even if u made it work it will be a bad idea coz then anyone can just pull ur code from the site. it wont work though. i dunno how u made it work in the past. may be some permission setting will do the trick, but still...
I don't think the idea is to include PHP code, because it would actually just include the HTML that is produced by the PHP script on the remote server. I think the best way of testing whether its a firewall issue is trying to use the CURL libraries to pull the HTML from the external server. If you have CURL available in your PHP installation. To check if you have the CURL libraries included in your installation, simply make a small php script that calls phpinfo(); and look at the results of that for CURL. <?php ob_start(); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://renaissancewomanonline.com/copyrightnotice.php"); curl_setopt($ch,CURLOPT_HEADER,FALSE); curl_exec($ch); curl_close($ch); $includedHTML = ob_get_contents(); ob_end_clean(); echo $includedHTML; ?> Code (Example): If the above does not work, then its more than likely a firewall issue not allowing the server to connect to the external site.
if its including the html code then the above is the best way. inlude is used to include the code and i cudnt think that he is using that to get the html code.
The code is on a different domain but is it on a different hosting account? If it's the same hosting account then you can include by using the actual file path. To find out the path of the calling file use echo getcwd(); PHP: and edit that into the include statement until you get your file.
I had the same problem, its almost certainly the firewall on the server that needs setting up to allow access to the other domain.