...

View Full Version : curl help please



kevinkhan
11-03-2010, 08:37 PM
can anybody explain the following lines of code please. im new to curl and desperately trying to learn it


curl_setopt($curl_handle, CURLOPT_HEADER, 0);
//curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_handle, CURLOPT_CAPATH, SSL_CA_FILE);
curl_setopt($curl_handle, CURLOPT_COOKIEJAR, COOKIE_FILE);
curl_setopt($curl_handle, CURLOPT_COOKIEFILE, COOKIE_FILE);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3");

//login to initialize cookies
curl_setopt($curl_handle, CURLOPT_URL, 'https://login.facebook.com/login.php');
curl_setopt($curl_handle, CURLOPT_POST, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $qryString);
$page = curl_exec($curl_handle);

sleep(1);
unset($logInPage);

curl_setopt($curl_handle, CURLOPT_URL, 'https://login.facebook.com/login.php');
curl_setopt($curl_handle, CURLOPT_POST, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $qryString);
$page = curl_exec($curl_handle);

unset($qryString);

// get home page
curl_setopt($curl_handle, CURLOPT_POST, 0);
curl_setopt($curl_handle, CURLOPT_URL, 'http://www.facebook.com/home.php');
$page = curl_exec($curl_handle);

Rowsdower!
11-03-2010, 08:50 PM
Which part is confusing you? Have you read the documentation?

http://us.php.net/manual/en/function.curl-setopt.php
http://us.php.net/manual/en/function.curl-exec.php

Let us know specifically where you're getting lost.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum