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

Rick Estrada <[email protected]>
Newsgroups gmane.comp.web.curl.php
Message-ID <[email protected]>
well i was trying to load the YOUTUBE API to get the XML and the DATA about
the Video

http://gdata.youtube.com/feeds/api/videos/dxOpi41Jbys

which it downloads in my browser fine but when i put on my server in the php
file it does not work and it returns me a different page...


  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, '
http://gdata.youtube.com/feeds/api/videos/dxOpi41Jbys');
  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);

as i tested our page and it works correctly?

is there a way bypass IP-range restriction and see if thats the problem.
Thats would be weird as i can grab other videoid's no proble

i never tried the PROXY with curl so can that help test and see if that the
issue or something i can see in the headers or something?





On Wed, Jul 29, 2009 at 4:52 AM, Liu Shan Shui <[email protected]> wrote:

>  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
>
>
>

_______________________________________________
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.