Facebook curl script explaination with json

Awarded Posted Nov 7, 2010 Paid on delivery
Awarded Paid on delivery

i need someone to be able to explain about 5 funcitions in php and curl and also need some additional features added to a facebook curl script that i have

One of the functions i would need to be explained is this

function getFriendLinkForReq(&$curl_handle, $con, $profileid, $post_form_id, $fb_dtsg, $checkReq, $cityList) {

$profileCnt = 1;

$linkCnt = 0;

$url = '[url removed, login to view]'.$profileid.'&__a=1&__d=1';

curl_setopt($curl_handle, CURLOPT_POST, 0);

curl_setopt($curl_handle, CURLOPT_URL, $url);

$page = curl_exec($curl_handle);

$page = str_ireplace('for (;;);', '', $page);

$json_output = json_decode($page);

$tmp1 = '"pb_'.$profileid.'",';

$tmp2 = ', 100, "Profile");';

$tempstr = substr($json_output->onload[6], strpos($json_output->onload[6],$tmp1)+strlen($tmp1), strpos($json_output->onload[6],$tmp2)-strpos($json_output->onload[6],$tmp1)-strlen($tmp1)) ;

$json_output = json_decode($tempstr);

if($json_output[0]->entities) {

foreach($json_output[0]->entities as $e) {

$linkCnt++;

addToReqTable($curl_handle, $con, $e->href.'&v=info', $cityList, $checkReq, $profileCnt);

$profileCnt++;

}

}

$url = '[url removed, login to view]';

if($linkCnt == 0) {

$curPages = 0;

} else {

$curPages = 1;

}

$totalPages = 1;

do{

$qryString = 'class=FriendManager&edge_type=everyone&fb_dtsg='.$fb_dtsg.'&limit=100&post_form_id_source=AsyncRequest&node_id='.$profileid.'&page='.$curPages.'&post_form_id='.$post_form_id;

curl_setopt($curl_handle, CURLOPT_POST, 1);

curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $qryString);

curl_setopt($curl_handle, CURLOPT_URL, $url);

$page = curl_exec($curl_handle);

$page = str_ireplace('for (;;);', '', $page);

$json_output = json_decode($page);

if($json_output->error && $json_output->error == 0) {

break;

}

if(($linkCnt == 0 && $curPages == 0) ||($linkCnt != 0 && $curPages == 1)) {

preg_match('|"count":[0-9]*,|', $page, $match);

$totalPages = str_replace("\"count\":", "", $match[0]);

$totalPages = trim($totalPages, ",");

$totalPages = ceil(((float)$totalPages)/100.0);

echo "totalPages:".$totalPages;

}

if($json_output->payload->user_info) {

foreach($json_output->payload->user_info as $u) {

if($checkReq && $u->action=='add_friend') {

addToReqTable($curl_handle, $con, $u->href.'&v=info', $cityList, $checkReq, $profileCnt);

$profileCnt++;

} else {

addToReqTable($curl_handle, $con, $u->href.'&v=info', $cityList, $checkReq, $profileCnt);

$profileCnt++;

}

}

}

$curPages++;

} while($curPages < $totalPages);

unset($json_output, $page);

}

my budget is 30$ or less

PHP Software Architecture

Project ID: #846515

About the project

3 proposals Remote project Active Dec 18, 2010

3 freelancers are bidding on average $110 for this job

SigmaVisual

We can help in your project, please check PMB and our ratings/reviews to get idea of our experience.

$250 USD in 7 days
(220 Reviews)
7.7
srinichal

I can explain and do the script additions

$50 USD in 2 days
(90 Reviews)
6.9
ghoshkumarsamir

Kindly check your pm.

$30 USD in 2 days
(0 Reviews)
0.0