You are here: Re: redirection based on not connecting to url (fsockopen) « PHP Programming Language « IT news, forums, messages
Re: redirection based on not connecting to url (fsockopen)

Posted by venks79 on 08/28/06 03:25

Oops my bad, I didnt check the full thread before replying.


venk...@gmail.com wrote:
> Hi John,
>
> Theoretically, fsockopen is meant to return FALSE when the call fails.
> So, an "if" statement should do the trick to check if a connection was
> made or not. I havent tested it myself so cannot elaborate.
> It'll help if you can post the exact warnings you are getting.
>
> Regards,
> Venkatesh Kanchan.
>
>
> 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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация