RE: Can Not Load Youtube Page To Get Source Code In Php

"Liu Shan Shui" <[email protected]>
Newsgroups gmane.comp.web.curl.php
Message-ID <001601ca1043$04088180$0c198480$@sg>
Hi Rick,

 

Your code works fine. It's probably some IP-range restriction for that video
on Youtube's side that's blocking your server.

http://phpieceofcake.com/?76868110

 

With regards,

Liu Shan Shui

[email protected]

"Life would be much easier if I had the source code." - Anonymous

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Rick Estrada
Sent: Wednesday, July 29, 2009 6:47 PM
To: [email protected]
Subject: Can Not Load Youtube Page To Get Source Code In Php

 

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.