SitePoint Sponsor |
|
User Tag List
Results 1 to 1 of 1
-
Nov 9, 2009, 10:22 #1
- Join Date
- Mar 2004
- Location
- Orlando, FL
- Posts
- 151
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
How to be logged in to a page through curl?
I posted a few days ago asking how to load a page from facebook through curl or implode and ended up being shown the following code:
Code:<?php function curl_get_contents($url) { $handle = curl_init(); curl_setopt($handle, CURLOPT_URL , $url); curl_setopt($handle, CURLOPT_RETURNTRANSFER , true); curl_setopt($handle, CURLOPT_MAXREDIRS , 5); curl_setopt($handle, CURLOPT_FOLLOWLOCATION , true); curl_setopt($handle, CURLOPT_USERAGENT , 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.1.4) Gecko/20091016 Firefox/3.5.4'); return curl_exec($handle); } $data = curl_get_contents('http://www.facebook.com'); echo $data; ?>
Bookmarks