<?php
$parameters = array();
foreach ($argv as $param) {
$temp = explode('=', $param);
if (count($temp) == 2) {
$parameters[$temp[0]] = $temp[1];
}
}
$action = $parameters['action'];
switch ($action) {
case 'post':
$attachment = array(
'access_token' => $parameters['access_token'],
'name' => $parameters['name'].' - asdasdasd',
'link' => 'https://www.facebook.com/pages/PARKINGaz/{здесь fan_page_id}',
'description' => $parameters['auto_number'],
'picture' => 'http://domain.com/uploads/cars/small/'.$parameters['photo_name'].'',
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://graph.facebook.com/'.$parameters['userid'].'/feed');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result= curl_exec($ch);
curl_close ($ch);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://graph.facebook.com/{здесь fan_page_id}/feed');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result= curl_exec($ch);
curl_close ($ch);
break;
case 'comment':
$attachment = array(
'access_token' => $parameters['access_token'],
'message' => $parameters['comment'],
'name' => $parameters['name'].' - asdasdsd',
'link' => 'https://www.facebook.com/pages/PARKINGaz/{здесь fan_page_id}',
'description' => $parameters['auto_number'],
'picture' => 'http://domain.com/uploads/cars/small/'.$parameters['photo_name'].'',
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://graph.facebook.com/'.$parameters['userid'].'/feed');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result= curl_exec($ch);
curl_close ($ch);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://graph.facebook.com/{здесь fan_page_id}/feed');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result= curl_exec($ch);
curl_close ($ch);
break;
case 'king':
$attachment = array(
'access_token' => $parameters['access_token'],
'name' => $parameters['name'].' - asdasdasd',
'link' => 'https://www.facebook.com/pages/PARKINGaz/{здесь fan_page_id}',
'description' => $parameters['auto_number'],
'picture' => 'http://domain.com/uploads/cars/small/'.$parameters['photo_name'].'',
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://graph.facebook.com/'.$parameters['userid'].'/feed');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result= curl_exec($ch);
curl_close ($ch);
break;
}