Hello

I am using the following command to bring the entire screen within my webiste but it it looking for images on my server and not the site im pulling the screen from.
Any ideas how to code it so that it gets the images from the server im getting the content from.

<?php 
$file = file_get_contents ("https://site.com); 
Echo $file; 
?> 

Many thanks
PHPNEWTOIT
😕

    you'd probably have to replace all instances om img src=.. to absolute paths using a regexp (Unless you are sure there are only local links to images, in which case you could do a simple str_replace()

      Or, if you're not changing anything in the content, just use a HTML IFRAME instead of PHP.

        Hi

        I am not able to use an Iframe the client has said this is not allowed for some reason.

        Being fairy new to php how would I code either of the options.🙂

        If i right click the image on my server it show as follows: -

        http://www.myserver.com/ref/images/CMB01/CTBMLogo1.gif

        If i right click it on the server I am allowed to use the content from it is as follows: -

        https://www.thereserver.co.uk/ref/images/CMB01/CTBMLogo1.gif

        This is the script im using:-

        <?php 
        $file = file_get_contents ("https://www.theserver.co.uk"); 
        Echo $file; 
        ?> 

        Thanks
        PHPNEWTOIT

          You could try using the <base> element, something like this:

          <?php
          $uri = 'https://www.somewhere.com/';
          $html = file_get_contents($uri);
          if($html !== FALSE)
          {
             $html = preg_replace('/<head>/i', "<head>\n<base href='$uri'>\n", $html);
             echo $html;
          }
          else
          {
             // error message here...
          }
          ?>
          

            Hi

            Thanks for that I think that worked just need a little tweking elsewhere on the site now.

            PHPNEWTOIT

              Write a Reply...