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

$opts = array(
    'header'=>"Accept-language: en\r\n" .
              "Cookie: foo=bar\r\n"

$context = stream_context_create($opts);

$fp = fopen('', 'r', false, $context);

Of course isn't registered yet. This will load the index page
of fine ( since I use hosts file to resolve 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 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,

On Fri, Mar 2, 2012 at 10:09 PM, Micky Hulse <> wrote:

> Hello,
> On Fri, Mar 2, 2012 at 8:07 AM, Jim Lucas <> wrote:
> >> But on some of my servers, curl isn't enabled! Is there any equivalent
> >> code
> >> to  achieve the same?
> I've used a combination of output buffering [1], readfile() [2] and
> caching (specific to the framework I was using).
> Simply, you could resort to:
> <?php readfile(''); ?>
> Ofc, the links would need to be absolute in order for the assets to load.
> Good luck!
> Cheers,
> Micky
>    [1]
>    [2]
> --
> PHP General Mailing List (
> To unsubscribe, visit:



Reply via email to