I want to make a PHP page for sending like with API from social media panel which I have a membership.
They give me this example but I don't understand completely.
Example Code:
<?php
class Api
{
public $api_url = 'http://domain/api/v2'; // API URL
public $api_key = ''; // Your API key
public function order($data) { // add order
$post = array_merge(array('key' => $this->api_key, 'action' => 'add'), $data);
return json_decode($this->connect($post));
}
public function status($order_id) { // get order status
return json_decode($this->connect(array(
'key' => $this->api_key,
'action' => 'status',
'id' => $order_id
)));
}
public function services() { // get services
return json_decode($this->connect(array(
'key' => $this->api_key,
'action' => 'services',
)));
}
public function balance() { // get balance
return json_decode($this->connect(array(
'key' => $this->api_key,
'action' => 'balance',
)));
}
private function connect($post) {
$_post = Array();
if (is_array($post)) {
foreach ($post as $name => $value) {
$_post[] = $name.'='.urlencode($value);
}
}
$ch = curl_init($this->api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
if (is_array($post)) {
curl_setopt($ch, CURLOPT_POSTFIELDS, join('&', $_post));
}
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
$result = curl_exec($ch);
if (curl_errno($ch) != 0 && empty($result)) {
$result = false;
}
curl_close($ch);
return $result;
}
}
// Examples
$api = new Api();
$services = $api->services(); # return all services
$balance = $api->balance(); # return user balance
// add order
$order = $api->order(array('service' => 1, 'link' => 'http://example.com/test', 'quantity' => 100)); # Default
$order = $api->order(array('service' => 1, 'link' => 'http://example.com/test', 'quantity' => 100, 'keywords'=>"test, testing")); # SEO
$order = $api->order(array('service' => 1, 'link' => 'http://example.com/test', 'comments' => "good pic\ngreat photo\n:)\n;)")); # Custom Comments
$order = $api->order(array('service' => 4, 'link' => 'http://example.com/test', 'quantity' => 100, 'usernames'=>"test, testing", 'hashtags'=>"#goodphoto")); # Mentions with Hashtags
$order = $api->order(array('service' => 5, 'link' => 'http://example.com/test', 'usernames' => "test\nexample\nfb")); # Mentions Custom List
$order = $api->order(array('service' => 6, 'link' => 'http://example.com/test', 'quantity' => 100, 'hashtag'=>"test")); # Mentions Hashtag
$order = $api->order(array('service' => 7, 'link' => 'http://example.com/test', 'quantity' => 1000, 'username'=>"test")); # Mentions User Followers
$order = $api->order(array('service' => 8, 'link' => 'http://example.com/test', 'quantity' => 1000, 'media'=>"http://example.com/p/Ds2kfEr24Dr")); # Mentions Media Likers
$order = $api->order(array('service' => 9, 'link' => 'http://example.com/test', 'quantity' => 1000, 'usernames'=>"test")); # Mentions
$order = $api->order(array('service' => 10, 'link' => 'http://example.com/test')); # Package
$order = $api->order(array('service' => 12, 'link' => 'http://example.com/test', 'quantity' => 100, 'runs' => 10, 'interval' => 60)); # Drip-feed
$order = $api->order(array('service' => 11, 'username' => 'username', 'min' => 100, 'max' => 110, 'posts' => 0,'delay' => 30)); # Subscriptions
$status = $api->status($order->order); # return status, charge, remains, start count
?>
For now, I want to see "get balance" on my PHP page but I couldn't do. I fill API URL and API key. Could you help me how can I do?
Thanks
You would use the API by calling balance() on it, like so;
$api = new Api();
$response = $api->balance();
// The response has "balance" and "currency" properties, which can be accessed like so;
echo "Your balance is " . $response->balance . " " . $response->currency;
Related
need help. im stop with this situation, i got an error that i don't understand. i think because i am weak in this. i have API payment and i use CURL. i actually get the encoded value but when i try using CURL to pas the value to API. i got this setContent() must be of the type string or null.. take a look my code.
$credentials = $this->creds();
$secret_key = $credentials->private_key;
//$secret_key = 'cxl+hwc%97h6+4#lx1au*ut=ml+=!fx85w94iuf*06=rf383xs';
$public_key = $credentials->public_key;
//$public_key = '7)5dmcfy^dp*9bdrcfcm$k-n=p7b!x(t)_f^i8mxl#v_+rno*x';
$merchant_id = "3581";
$dataToHash = "5a8c12eb19016500.00PHPMy Product";
$secure_hash = hash_hmac('sha256', $dataToHash, $secret_key, false);
$auth_hash = hash_hmac('sha256', $public_key, $secret_key, false);
$customer_array = array (
'merchant_id' => $merchant_id,
'merchant_ref_no' => "6a2c14eb19355",
'merchant_additional_data' => "Additional Data",
'amount' => 1500,
'currency' => 'PHP',
'description' => "Description",
'billing_email' => "email#gmail.com",
'billing_first_name' => "jayson",
'billing_last_name' => "claros",
'billing_middle_name' => "curada",
'billing_phone' => "123456789",
'billing_mobile' => "12345678",
'billing_address' => "address1",
'billing_address2' => "address2",
'billing_city' => "None",
'billing_state' => "None",
'billing_zip' => "None",
'billing_country' => "None",
'billing_remark' => "None",
'payment_method' => 'BOG',
'status_notification_url' => 'https://242c3.ngrok.io/callback',
'success_page_url' => "",
'failure_page_url' => "",
'cancel_page_url' => "",
'pending_page_url' => "",
'secure_hash' => $secure_hash,
'auth_hash' => $auth_hash,
'alg' => 'HS256',
);
// $payform_data = json_encode($raw_payform, JSON_UNESCAPED_SLASHES);
// $decoded = utf8_decode(base64_encode(utf8_encode($payform_data)));
$billing_json = json_encode($customer_array, JSON_UNESCAPED_SLASHES);
$datax= base64_encode($billing_json);
$URL = 'https://api.paymentget.com/payform-link?format=json';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $URL);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS,$datax);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$rest = curl_exec($curl);
if($err = curl_error($curl)) {
echo $err;
} else {
$decoded = json_decode($rest);
}
return $decoded;
the result should look like this.
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJtZXJjaGFudCI6ODUyOSwibWVyY2hhbnRfbmFtZSI6IlRvdXJpc21vUEggQ29ycG9yYXRpb24iLCJtZXJjaGFudF9mZWUiOjAuMCwibWVyY2hhbnRfbGV2ZWwiOjIsImFwcGx5X2ZlZXMiOnRydWUsImNhc2hfaW5fbGltaXQiOi0xLjAsInBheW1lX251bWJlciI6ODY2NDIyLCJtZXJjaGFudF9zaG91bGRlcmVkIjp0cnVlLCJhbW91bnQiOjUwOTIuMCwiZGVzY3JpcHRpb24iOiJDb3JyZWRvciBJcy4sIFRoZSBSb2NrIGJvb2tpbmciLCJtZXJjaGFudF9yZWZfbm8iOiI1YThjMTJlYjE5MDE2IiwibWVyY2hhbnRfYWRkaXRpb25hbF9kYXRhIjoiQWRkaXRpb25hbCBEYXRhIiwicHVycG9zZSI6IiIsInNvdXJjZSI6IiIsInNwZWNpZnkiOiIiLCJjY19tZHIiOjAsImNjX2ZlZSI6MCwiYWdncmVnYXRvcl9mZWUiOjB9.MHHqWbf74rokfxqdHJ1HXwB8NEGo24uQBjhdMtuRvGc&form_data=eyJtZXJjaGFudF9pZCI6Ijg1MjkiLCJtZXJjaGFudF9yZWZfbm8iOiI1YThjMTJlYjE5MDE2IiwibWVyY2hhbnRfYWRkaXRpb25hbF9kYXRhIjoiQWRkaXRpb25hbCBEYXRhIiwiYW1vdW50IjoiNTA5Mi4wMCIsImN1cnJlbmN5IjoiUEhQIiwiZGVzY3JpcHRpb24iOiJDb3JyZWRvciBJcy4sIFRoZSBSb2NrIGJvb2tpbmciLCJiaWxsaW5nX2VtYWlsIjoiamF5c29uLmNsYXJvc0BnbWFpbC5jb20iLCJiaWxsaW5nX2ZpcnN0X25hbWUiOiJkZmRmIiwiYmlsbGluZ19sYXN0X25hbWUiOiJzZHNkcyIsImJpbGxpbmdfbWlkZGxlX25hbWUiOiJOb25lIiwiYmlsbGluZ19waG9uZSI6IjA5NDY2ODI5NDIyIiwiYmlsbGluZ19tb2JpbGUiOiIwOTQ2NjgyOTQyMiIsImJpbGxpbmdfYWRkcmVzcyI6IjE0MjUgZmRnZmcuZSBoc2pzaiBramFramFzIiwiYmlsbGluZ19hZGRyZXNzMiI6Ik5vbmUiLCJiaWxsaW5nX2NpdHkiOiJtYW5pbGFgIiwiYmlsbGluZ19zdGF0ZSI6Ik5vbmUiLCJiaWxsaW5nX3ppcCI6Ik5vbmUiLCJiaWxsaW5nX2NvdW50cnkiOiJOb25lIiwiYmlsbGluZ19yZW1hcmsiOiJOb25lIiwicGF5bWVudF9tZXRob2QiOiJCT0ciLCJzdGF0dXNfbm90aWZpY2F0aW9uX3VybCI6Imh0dHBzOi8vNjM0MmEzMzQubmdyb2suaW8vY2FsbGJhY2siLCJzdWNjZXNzX3BhZ2VfdXJsIjoiaHR0cHM6Ly9ib29raW5nLmV0b3VyaXNtby5jb20vbGlzdGluZy1jaGVja291dC8/cGF5bWVudD1zdWNjZXNzJiIsImZhaWx1cmVfcGFnZV91cmwiOiJodHRwczovL2Jvb2tpbmcuZXRvdXJpc21vLmNvbS9wYXltZW50LWZhaWxlZC8iLCJjYW5jZWxfcGFnZV91cmwiOiJodHRwczovL2Jvb2tpbmcuZXRvdXJpc21vLmNvbS9saXN0aW5nLWNoZWNrb3V0Lz9wYXltZW50PWNhbmNlbCYiLCJwZW5kaW5nX3BhZ2VfdXJsIjoiaHR0cHM6Ly9ib29raW5nLmV0b3VyaXNtby5jb20vbGlzdGluZy1jaGVja291dC8/cGF5bWVudD1wZW5kaW5nJiIsInNlY3VyZV9oYXNoIjoiNmUyOTA4ZjdmZDUwYWIwZDg3ZjllY2QxMTNiN2ViYzg4MGYxNzNhNTNhMjM3YzJlNDU2NWVjNjcyNjkxZDlhZCIsImF1dGhfaGFzaCI6IjYwY2Q2MjkyZmY0MDIzZWRmNmZlMjE0YWU0MjUyN2JhMzUzZjViODM5OTEzZDc1NWMyMTllZmJkNDc1MmUyMWEiLCJhbGciOiJIUzI1NiJ9
I am trying to integrate paygate payment gateway integration into my PHP API. I have gone through their documentation but it is not clear for me. There were three endpoints
initiate
return
query
I don't which endpoint to use. Now I am using initiate endpoint, but when testing in postman I am getting an error
ERROR=DATA_CHK error
Can anyone guide me to sort this out...
public function subscription(Request $request) {
$validator = Validator::make(
$request->all(),
array(
'subscription' => 'required|integer',
'email' => 'required|exists:users,email',
'amount' => 'required|integer',
'payment_mode' => 'required|integer',
),
array(
'exists' => 'The :attribute doesn\'t exists',
)
);
if ($validator->fails()) {
$error_messages = implode(',', $validator->messages()->all());
$response_array = array('success' => false, 'error' => Helper::get_error_message(101), 'error_code' => 101, 'error_messages'=>$error_messages);
} else {
$encryptionKey = 'AQ2Uted8BidhkIEv6oYgrqwS';
$data = array(
'PAYGATE_ID' => 1039433100014,
'REFERENCE' => 'pgtest_123456789',
'AMOUNT' => 3299,
'CURRENCY' => 'ZAR',
'RETURN_URL' => 'http://localhost/avvata/public/home',
'TRANSACTION_DATE' => date('Y-m-d H:i:s'),
'LOCALE' => 'en-za',
'COUNTRY' => 'ZAF',
'EMAIL' => $request->email,
);
$checksum = md5(implode('', $data) . $encryptionKey);
$data['CHECKSUM'] = $checksum;
$fieldsString = http_build_query($data);
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, 'https://secure.paygate.co.za/payweb3/initiate.trans');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_NOBODY, false);
curl_setopt($ch, CURLOPT_REFERER, $_SERVER['HTTP_HOST']);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fieldsString);
//execute post
$result = curl_exec($ch);
echo $result;
exit();
//close connection
curl_close($ch);
}`
Thanks in advance :-)
I'm trying to integrate Paypal express checkout integration with PayPal REST API.
JS file looks like this:
paypal.Button.render({
env: 'sandbox', // sandbox | production
commit: true,
payment: function() {
var CREATE_URL = 'createpayment';
return paypal.request.get(CREATE_URL)
.then(function(res) {
return res.paymentID;
});
},
onAuthorize: function(data, actions) {
var EXECUTE_URL = 'executepayment';
var data = {
paymentID: data.paymentID,
payerID: data.payerID
};
return paypal.request.post(EXECUTE_URL, data)
.then(function (res) {
window.alert('Payment Complete!');
});
}
}, '#paypal-button-container');
Now I can't figure out what should be in CREATE_URL and EXECUTE_URL url's php files. I have read a lot of their docs. I understand that in php I should make first request to get token, then I should make create-payment request and after execute-payment curl reuqest. But I have no-luck.
I also don't understand how should I pass payment value to CREATE_URL php file.
Several days ago I found here some good answer of my question with all examples, but it's about two days I can't find it.
Update: ALso I need to pass input amount to php file from payment request. And I can't do that using return paypal.request.get(CREATE_URL, data)
request.
Can anybody help me please.
Thank you.
Share some examples for server PHP code.
PHP Code in CREATE_URL:
<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_URL, 'https://api-3t.sandbox.paypal.com/nvp');
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query(array(
'USER' => 'xxxxx',
'PWD' => 'xxxxx',
'SIGNATURE' => 'xxxxx',
'METHOD' => 'SetExpressCheckout',
'VERSION' => '108',
'LOCALECODE' => 'en_US',
'PAYMENTREQUEST_0_AMT' => 100,
'PAYMENTREQUEST_0_CURRENCYCODE' => 'USD',
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
'PAYMENTREQUEST_0_ITEMAMT' => 100,
'L_PAYMENTREQUEST_0_NAME0' => 'test name',
'L_PAYMENTREQUEST_0_DESC0' => 'test desc',
'L_PAYMENTREQUEST_0_QTY0' => 1,
'L_PAYMENTREQUEST_0_AMT0' => 100,
'CANCELURL' => 'http://localhost/cancel.html',
'RETURNURL' => 'http://localhost/success.html'
)));
$response = curl_exec($curl);
curl_close($curl);
$nvp = array();
if (preg_match_all('/(?<name>[^\=]+)\=(?<value>[^&]+)&?/', $response, $matches)) {
foreach ($matches['name'] as $offset => $name) {
$nvp[$name] = urldecode($matches['value'][$offset]);
}
}
if (isset($nvp['ACK']) && $nvp['ACK'] == 'Success') {
echo $nvp['TOKEN'];
} else {
//failed
}
?>
PHP Code in EXECUTE_URL:
<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_URL, 'https://api-3t.sandbox.paypal.com/nvp');
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query(array(
'USER' => 'xxxxx',
'PWD' => 'xxxxx',
'SIGNATURE' => 'xxxxx',
'METHOD' => 'DoExpressCheckoutPayment',
'VERSION' => '108',
'LOCALECODE' => 'en_US',
'TOKEN' => $_POST['TOKEN'],
'PayerID' => $_POST['PAYERID'],
'PAYMENTREQUEST_0_AMT' => 100,
'PAYMENTREQUEST_0_CURRENCYCODE' => 'USD',
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
'PAYMENTREQUEST_0_ITEMAMT' => 100,
'L_PAYMENTREQUEST_0_NAME0' => 'test name',
'L_PAYMENTREQUEST_0_DESC0' => 'test desc',
'L_PAYMENTREQUEST_0_QTY0' => 1,
'L_PAYMENTREQUEST_0_AMT0' => 100,
)));
$response = curl_exec($curl);
curl_close($curl);
$nvp = array();
if (preg_match_all('/(?<name>[^\=]+)\=(?<value>[^&]+)&?/', $response, $matches)) {
foreach ($matches['name'] as $offset => $name) {
$nvp[$name] = urldecode($matches['value'][$offset]);
}
}
print_r($nvp);
I am trying to send push notification through push woosh such like this :
is anybody help me how to send push notification on device from this code
function pwCall(
'createMessage', array(
'application' => PW_APPLICATION,
'auth' => PW_AUTH,
"devices" => PW_DEVICETOKEN,
'notifications' => array(
'send_date' =>'now', //gmdate('d-m-Y H:i', strtotime('2014-04-07 20:35')),
'content' => 'my custom notification testing ',
'link' => 'http://pushwoosh.com/',
'content' => array("en" => "English","ru" =>"Русский","de"=>"Deutsch")
),
'page_id' => 16863,
'link' => 'http://google.com',
'data' => array( 'custom' => 'json data' ),
)
);
I am getting error such as
Array ( [status_code] => 210 [status_message] => Cannot parse date [response] => )
notifications should be array of objects in JSON notation. In PHP it will be array of arrays. This is because you can create multiple notifications in one request.
final JSON for notifications field:
"notifications":[{ ... notification properties... }, { ... second notification properties ... }, ...]
There are only 3 root parameters in request: application(OR applications_group), auth, and notifications. Other parameters are parameters of notification, not request.
Finally your PHP call should be like following:
pwCall("createMessage", array(
"auth" => PW_AUTH,
"application" => PW_APPLICATION,
"notifications" => array(
array(
"send_date" => "now",
"content" => array("en" => "English", "ru" =>"Русский", "de"=>"Deutsch"),
"link" => "http://pushwoosh.com/",
"page_id" => 16863,
"devices" => array( PW_DEVICETOKEN ),
"data" => array( "custom" => "json data" )
)
)
));
All notification's fields except of send_date and content are optional and can be omited
By the looks of it, your date is not formatted correctly. You're passing an ordinary string consisting of the word "now". What you'll want to do is something along the lines of the following:
function pwCall("createMessage", array(
"application" => PW_APPLICATION,
"auth" => PW_AUTH,
"devices" => PW_DEVICETOKEN,
"notifications" => array(
"send_date" => gmdate("Y-m-d H:i"),
"content" => "My custom notification",
"link" => "http://pushwoosh.com/",
"content" => array("en" => "English", "ru" =>"Русский", "de"=>"Deutsch")
),
"page_i" => 16863,
"link" => "http://google.com",
"data" => array("custom" => "json data"),
)
);
we've developped an API to easily call the Pushwoosh Web Services.
This API should be a good quality one and is fully tested (very high code coverage).
https://github.com/gomoob/php-pushwoosh
$push_auth = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$push_app_id = 'XXXXX-XXXXX';
$push_debug = false;
$title = ''; // pushwoosh title
$banner = ''; // pushwoosh banner
$send_date = 'now'; // pushwoosh date
$android_header = ''; // pushwoosh android header
$android_custom_icon = '' pushwoosh notification icon;
sendpush('createMessage', array(
'application' => $push_app_id,
'auth' => $push_auth,
'notifications' => array(
array(
'send_date' => $send_date,
'content' => $title,
'android_header'=>$android_header,
'android_custom_icon' =>$android_custom_icon,
'android_badges' => 2,
'android_vibration' => 1,
'android_priority' => 1,
'data' => array('custom' => 'json data'),
),
)
));
function sendpush($method, $data) {
$url = 'https://cp.pushwoosh.com/json/1.3/' . $method;
$request = json_encode(['request' => $data]);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
$response = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
if (defined('PW_DEBUG') && self::$push_de) {
print "[PW] request: $request\n";
print "[PW] response: $response\n";
print "[PW] info: " . print_r($info, true);
}
return $info;
}
}
I am Trying to Tag a picture and posting it through graphs However, when I remove the 'tags' => $tags from below, it works. Otherwise I get this error:
Array ( [error] => Array ( [message] => (#100) param tags must be an array. [type] => OAuthException [code] => 100 ) )
Here is my code:
<?php
$tags = array(
'to' => $_SESSION['my_fb_id'],
'x' => 0,
'y' => 0
);
$tag[]= $tags ;
//
//upload photo
$file = 'imgtmp/save_as_this_name.jpg';
$args = array(
'message' => 'This is my Picture',
'tags' => $tag, // IF this line is removed ,It works!
);
$args[basename($file)] = '#' . realpath($file);
$ch = curl_init();
$url = 'https://graph.facebook.com/me/photos?access_token=' . $_SESSION['access_token'];
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
$data = curl_exec($ch);
print_r(json_decode($data, true));
?>
Tags must be array of tags as you can tag many people.
$tag1 = array(
'tag_text' => 'tag test1',
'tag_uid' => 'XXXXX1',
'x' => 0,
'y' => 0
);
$tag2 = array(
'tag_text' => 'tag test2',
'tag_uid' => 'XXXXX2',
'x' => 0,
'y' => 0
);
$tags = array($tag1, $tag2);
In your case
$args = array(
'message' => 'This is my Picture',
'tags' => array( $tags ) ,
);
EDIT 1:
To tag photos successfully you will require user_photos permission.
Using graph api
$file = 'test.jpg';
$tags = array(
'tag_text' => 'tag test',
'tag_uid' => 'XXXXX',
'x' => 10,
'y' => 10
);
$args['tags'] = array($tags);
$args[basename($file)] = '#' . realpath($file);
$data = $facebook->api("/me/photos", "post", $args);
print_r($data);
Edit 2:
Just use json_encode for tags parameter
$args['tags'] = json_encode(array($tags));
This will solve the issue while using cURL.
Alright I got it. From the Facebook API:
"tags": {
"data": [
{
"id": "11111111111111",
"name": "John Doe",
"x": 0,
"y": 0,
"created_time": "2012-09-03T03:08:44+0000"
}
]
},
The tags arg needs to contain an array with data as the key. Here:
$tags['data'] = array(
'to' => $_SESSION['my_fb_id'],
'x' => 0,
'y' => 0 );