curl-and-php
Can Not Load Youtube Page To Get Source Code In Php
Date: Wed, 29 Jul 2009 03:46:53 -0700
I was trying to use CURL to load a WEBPAGE from YOUTUBE but it does not grab
any info as it seems to get blocked... I do not have problems using the CURL
on other webpages and even on the youtube frontpage...
here is the link...
http://www.youtube.com/watch?v=TTs-9hNyuB0
any help appreciated on this
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.youtube.com/watch?v=TTs-9hNyuB0'
);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT
5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$google_string = curl_exec($ch);
curl_close($ch);
$google_string = utf8_encode($google_string);
print_r($google_string);
-- Thanks, Rick Estrada Subfighter Mixed Martial Arts 760-908-9472 http://www.subfighter.tv
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2009-07-29