On Thu, January 25, 2007 12:06 am, [EMAIL PROTECTED] wrote:
> 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?

What is in $errno and $errstr for YouTube?

If you surf to that URL with LiveHTTPHeaders, what headers are flying
by?  If it's a bunch of re-directs, it's possible the fsockopen is
getting closed immediately after the headers, I guess, so maybe the
socket closes???  That don't sound right.

Still, find out what a browser does, and then mimic that well enough
that YouTube lets you through.

You may end up needing to use http://php.net/curl

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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

Reply via email to