cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

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

From: Liu Shan Shui <me_at_lx.sg>
Date: Wed, 29 Jul 2009 19:52:11 +0800

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

me_at_lx.sg

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

 

From: curl-and-php-bounces_at_cool.haxx.se
[mailto:curl-and-php-bounces_at_cool.haxx.se] On Behalf Of Rick Estrada
Sent: Wednesday, July 29, 2009 6:47 PM
To: curl-and-php_at_cool.haxx.se
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
Received on 2009-07-29