I have 2 domain
http://foammachines.net/ - main site
I use file_get_contents to have the same content from
foammachines.net and it work.
The problem is when I tried to echo the servername of
foamcuttingwire.net the output is foammachines.net.
it should display the server name that you visit not the servername you get the contents
is there a way to exclude the URL in getting the contents.
I sorry if my explanation is not clear.
@gerryl and welcome to the forum.
Please post the PHP script that is not working.
To ensure the PHP script is correctly formatted, please enclose the script between three back-ticks starting and finishing on a new line or use
Both URLs supplied are
I updated the post sir and its working now…
I have just tried this on my localhost:
$src = file_get_contents('http://foammachines.net/');
echo '<iframe src="' .$src .'" style="width:88%; margin:auto">';
http://foammachines.net/): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden
in / / on line 5 _FILENAME
As mentioned before both URLs supplied are not accessible.
If you are wanting to pull unevaluated code from one site to be evaluated on the other you could give the remote file a txt extension, then eval it on the calling site
* be forewarned and aware, using eval is not a good idea
The eval() language construct is very dangerous because it allows execution of arbitrary PHP code. Its use thus is discouraged. If you have carefully verified that there is no other option than to use this construct, pay special attention not to pass any user provided data into it without properly validating it beforehand.
its working sir
No problem either way, links to output is of little to no help with PHP code.
its working sir
The reason that is working is because
is calling a file which is located on the same site.
Try clicking both links in your original post. Maybe it is just my browser but both links cannot be displayed.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.