Re: Validating a link in php

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

 



Try changing that url to www.youtube.com:80/v/JqO8ZevPJNk

On 1/25/07, Robert Porter <sleestak2@xxxxxxxxxxxxx> wrote:

Frank Arensmeier wrote:
>Did you take a look at the error numbers / messages returned by
>fsockopen? What do they say?

Actually, I only get warnings, not errors, but here's what they say:

Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/html/je/jefflynnesongs.com/jlvids/jlvids.php on line 98

Warning: fsockopen(): unable to connect to www.youtube.com/v/JqO8ZevPJNk:80 in /var/www/html/je/jefflynnesongs.com/jlvids/jlvids.php on line 98

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

Hmmm... I just did some experimenting and it looks promising.
Here's the code that appears to work:

$ch = curl_init("http://www.youtube.com/v/JqO8ZevPJNk";);
if (curl_exec($ch))
  //Do stuff for a valid URL
else
  //Do stuff for an invalid URL

Many thanks!  I'm loving PHP, but I've got a lot to learn.

Robert

--
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