PHP and browser cookies usage

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
gilcamar
Forum Newbie
Posts: 3
Joined: Wed Dec 21, 2011 10:11 am

PHP and browser cookies usage

Post by gilcamar »

Hi,
I am trying to code an app, for personal use, capable to collect nicknames of friends and friends of firends
of facebook.
Since this should be a very simple app, not intended to be a chat client or whatever, I decided non to use
fb libs.
Basically, I did use PHP Simple HTML DOM parser to fetch the page and parse it for certain tags.
It works fine for some web pages, but not for fb since it directs it to the login page.
I wonder if there is some way or script to use fb cookies already stored on ff.
Do you have other ideas on how to do this ? Maybe, I am completely off track.
TIA
Gilcamar
User avatar
tr0gd0rr
Forum Contributor
Posts: 305
Joined: Thu May 11, 2006 8:58 pm
Location: Utah, USA

Re: PHP and browser cookies usage

Post by tr0gd0rr »

You can send cookies using curl_setopt()

Code: Select all

curl_setopt($ch, CURLOPT_COOKIE, "fbsession=$session_id");
You can code it using curl options such that facebook couldn't even discern between a browser and your script.
gilcamar
Forum Newbie
Posts: 3
Joined: Wed Dec 21, 2011 10:11 am

Re: PHP and browser cookies usage

Post by gilcamar »

Thanks, will try that.
I had to set
ini_set('user_agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9');
in order to let fb in at first.

gilcamar
Post Reply