|
Posted by Carl on 10/21/97 11:56
webbyfoot@gmail.com wrote:
> I've a form where users suggest a website by entering the url - and
> want to redirect them to a 'thanks but no thanks' page if the site
> doesn't actually exist
>
> I tried the following:
>
> $fp = fsockopen($HTTP_POST_VARS['url'],80, $errno, $errstr, 30);
> if(!$fp) {
> header("Location: nothanks.php");
> }
>
> But get 'Warning:' errors when fsockopen doesn't connect so my
> redirection header can't be written. There are no warnings when the url
> is good so its the failed connection - which is what I wanted to detect
> - not a script error thats causing the warnings.
>
> I expect there's a simple solution but I gave up trawling through the
> web after two hours and hope one of you kind folks can put me straight
> :-)
>
> Thanks,
>
> John
Hi John,
Have you tried suppressing the error returned by fsockopen using the
'@' op?
See http://www.php.net/manual/en/language.operators.errorcontrol.php
for details.
Carl.
Navigation:
[Reply to this message]
|