On Fri, Mar 2, 2012 at 6:09 PM, Nibin V M <nibi...@gmail.com> wrote:
> Hmm..I am a php newbie ( just started learning it )...
> what my need is to display website from my server always for a
> non-registered domain.This is the code I use now to display the website
> <?php
> $opts = array(
>  'http'=>array(
>    'method'=>"GET",
>    'header'=>"Accept-language: en\r\n" .
>              "Cookie: foo=bar\r\n"
>  )
> );
> $context = stream_context_create($opts);
> $fp = fopen('http://www.blahblah.com', 'r', false, $context);
> fpassthru($fp);
> fclose($fp);
> ?>
> Of course blahblah.com isn't registered yet. This will load the index page
> of blahblah.com fine ( since I use hosts file to resolve blahblah.com on
> the server ). But if we click on any link, it will give "server not found"
> error since my "local machine" is trying to resolve blahblah.com this time.
> I need to avoid it and want to load my domain "always" from the server when
> I click any link on the webpage, etc .
> How can I modify the above code to make it work! If possible, I request
> somebody to tell me the exact code that I need to change in the above
> script - since most of the php part is still greek to me :)
> Thank you,

Have you actually read/tried Daniel Browns reply?

The following seems to be all you need...

echo str_replace('blahblah.com','localhost',file_get_contents('blahblah.com'));

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to