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

curl-and-php

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

From: Rick Estrada <subfighter.tv_at_gmail.com>
Date: Wed, 29 Jul 2009 09:47:05 -0700

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 <me_at_lx.sg> 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
>
> me_at_lx.sg
>
> "Life would be much easier if I had the source code." - Anonymous
>
>
>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2009-07-29