Re: Validating a link in php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



25 jan 2007 kl. 07.06 skrev sleestak2@xxxxxxxxxxxxx:

Richard Lynch wrote:
I dunno what you did wrong with fsockopen...

First of all, thanks for taking the time to respond.

I had tried fsockopen, but here's the problem.  The
following calls work as expected, returning a valid file
pointer for valid urls and FALSE for invalid urls:

$fp = fsockopen("www.example.com", 80, $errno, $errstr, 30);
$fp = fsockopen("www.youtube.com", 80, $errno, $errstr, 30);
$fp = fsockopen("www.this_url_is_not_valid.com", 80, $errno, $errstr, 30);

The call below does not work and always returns FALSE.
If I enter the url in a web browser, it works fine, but
fsockopen does not like it.

$fp = fsockopen("www.youtube.com/v/JqO8ZevPJNk", 80, $errno, $errstr, 30);

I think it has something to do with the way YouTube
works.  Any clues?

Did you take a look at the error numbers / messages returned by fsockopen? What do they say? I can't see any problems with your code either. So, either the call gets stuck maybe due to some configuration on your machine (you can simply test it by changing you fsockopen call to e.g. www.php.net - or your lolcalhost), or - as you already mentioned - it is youTube that blocks your calls in some way (therefore, error message might give you a clue why).

Another thing that poped up in my mind - curl. Tried that?

//frank

Robert Porter

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


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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux