Re: Validating a link in php

From: Date: Fri, 26 Jan 2007 05:47:03 +0000
Subject: Re: Validating a link in php
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-247808@lists.php.net to get a copy of this message
Try changing that url to www.youtube.com:80/v/JqO8ZevPJNk On 1/25/07, Robert Porter <sleestak2@earthlink.net> 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


« previous php.general (#247808) next »