On 17/11/06, Jochem Maas <[EMAIL PROTECTED]> wrote:
Tom Chubb wrote:
> Confused!
> I'm now getting:
> file_get_contents(http://www.tnhosting.co.uk/scripts/gclub/player.php)
> [function.file-get-contents]: failed to open stream: Connection
> refused in
> /home/sites/tnhosting.co.uk/public_html/scripts/gclub/updateplaylist.php
> on line 75
> How come you can access it and I can't?!?

no php script can withstand me. ;-) seriously I don't know

I don't doubt it! ;-)


> Permissions are 755.
> Obviously I was getting it when using file_get_contents('player.php')
> but when using the URL I get connection refused.
>
> (Don't think that it makes any difference, but allow_url_fopen is on)

it makes a difference, and it sounds likes it's off - another possibility
is that safe_mode is on (and that safe_mode blocks allow_url_fopen), but I don't
know about that - you'll have to test it.


phpinfo() says that allow_url_fopen is on and safe mode is off

you can double check that you can reach your site from the box itself by doing a
very simple 'wget' check from the commandline (assuming you have ssh access):

       wget http://www.tnhosting.co.uk/scripts/gclub/player.php

if that downloads a page then the problem is very like to be php.

>

Don't have shell access on my shared server


...


Did manage to get it working though using

$player = file_get_contents('player.php');
//Strip out unnecessary HTML
if(preg_match('/<!-- Start Player Code -->(.*)<!-- End Player Code
-->/s', $player, $matches)) {
$content = $matches[1];
}

function phpWrapper($content) {
ob_start();
$content = str_replace('<'.'?php','<'.'?',$content);
eval('?'.'>'.trim($content).'<'.'?');
$content = ob_get_contents();
ob_end_clean();
return $content;
}

echo "<textarea name=\"textarea\" cols=\"70\" rows=\"15\">" .
phpWrapper($content) . "</textarea>";


Bit messy, but it works at least. :D
Thanks for your help though.

T

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

Reply via email to