Curl problem blank page displaying

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
edpudol
Forum Newbie
Posts: 2
Joined: Mon May 18, 2009 10:56 pm

Curl problem blank page displaying

Post by edpudol »

Hello to everyone, this is my first post and I am sorry because my first post is about problem...

I am developing a code where I am displaying some good tips in internet marketing at my site side bar...

I am using curl to open and parse some part of the page I like... the curl function work fine until find a facebook page that I want to parse. The problem is that it display blank page...

here is my code
I have using curl for one my application but I found this problem, that sometimes it does not get anything from the target page.... It display blank...

here is my code...

Code: Select all

 
$urls =  "http://www.facebook.com/pages/Seo-Tips-by-Peter-Drew-BruteForceSEO/86945032176";
$ch = curl_init($urls);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_HEADER, 0 );
$page = curl_exec($ch);
curl_close($ch);
 
The code above works fine at other site but don't work at facebook...

Thanks in advance
Last edited by Benjamin on Mon May 18, 2009 11:06 pm, edited 1 time in total.
Reason: Changed code type from text to php.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Curl problem blank page displaying

Post by Benjamin »

Try setting the CURLOPT_USERAGENT
edpudol
Forum Newbie
Posts: 2
Joined: Mon May 18, 2009 10:56 pm

Re: Curl problem blank page displaying

Post by edpudol »

astions wrote:Try setting the CURLOPT_USERAGENT
You're an angel.... thank you very much it's been more than 24 hours I am looking for a solution and now it's working...

:drunk:
Post Reply