The Square Checkout API Setup Guide example at:
https://docs.connect.squareup.com/payments/checkout/setup
says you need to store the CheckoutId for later verification. Unfortunately, whoever wrote the example (besides having a number of coding errors I mentioned elsewhere) did not complete the example and provide verification code. If they had, they might have seen that there is no transaction id matching capability.
Maybe I am missing something but if you compare the Checkout Object
object(SquareConnect\Model\CreateCheckoutResponse)#25 (2) {
["checkout":protected]=>
object(SquareConnect\Model\Checkout)#26 (10) {
["id":protected]=>
string(30) "xxxxxxxxxx"
["checkout_page_url":protected]=>
string(106) "removed for security"
["ask_for_shipping_address":protected]=>
bool(false)
["merchant_support_email":protected]=>
NULL
["pre_populate_buyer_email":protected]=>
string(16) "client#email.com"
["pre_populate_shipping_address":protected]=>
NULL
["redirect_url":protected]=>
string(43) "whateverreturn.php"
["order":protected]=>
object(SquareConnect\Model\Order)#27 (7) {
["id":protected]=>
NULL
["location_id":protected]=>
string(30) "xxxxxxxxxx"
["reference_id":protected]=>
NULL
["line_items":protected]=>
array(1) {
[0]=>
object(SquareConnect\Model\OrderLineItem)#28 (13) {
["name":protected]=>
string(16) "MyCheckout Title"
["quantity":protected]=>
string(1) "1"
["note":protected]=>
NULL
["catalog_object_id":protected]=>
NULL
["variation_name":protected]=>
NULL
["modifiers":protected]=>
NULL
["taxes":protected]=>
NULL
["discounts":protected]=>
NULL
["base_price_money":protected]=>
object(SquareConnect\Model\Money)#29 (2) {
["amount":protected]=>
int(60000)
["currency":protected]=>
string(3) "USD"
}
["gross_sales_money":protected]=>
object(SquareConnect\Model\Money)#30 (2) {
["amount":protected]=>
int(60000)
["currency":protected]=>
string(3) "USD"
}
["total_tax_money":protected]=>
object(SquareConnect\Model\Money)#31 (2) {
["amount":protected]=>
int(0)
["currency":protected]=>
string(3) "USD"
}
["total_discount_money":protected]=>
object(SquareConnect\Model\Money)#32 (2) {
["amount":protected]=>
int(0)
["currency":protected]=>
string(3) "USD"
}
["total_money":protected]=>
object(SquareConnect\Model\Money)#33 (2) {
["amount":protected]=>
int(60000)
["currency":protected]=>
string(3) "USD"
}
}
}
["total_money":protected]=>
object(SquareConnect\Model\Money)#34 (2) {
["amount":protected]=>
int(60000)
["currency":protected]=>
string(3) "USD"
}
["total_tax_money":protected]=>
object(SquareConnect\Model\Money)#35 (2) {
["amount":protected]=>
int(0)
["currency":protected]=>
string(3) "USD"
}
["total_discount_money":protected]=>
object(SquareConnect\Model\Money)#36 (2) {
["amount":protected]=>
int(0)
["currency":protected]=>
string(3) "USD"
}
}
["created_at":protected]=>
string(20) "2018-08-13T15:42:57Z"
["additional_recipients":protected]=>
NULL
}
["errors":protected]=>
NULL
}
to the Response object:
object(SquareConnect\Model\RetrieveTransactionResponse)#17 (2) {
["errors":protected]=>
NULL
["transaction":protected]=>
object(SquareConnect\Model\Transaction)#18 (10) {
["id":protected]=>
string(56) "A4ccOMcXsMJL14ZGAJUgQPqVW580zoRoGiVIQdWOgHLyXeThrKgTwLhO"
["location_id":protected]=>
string(30) "xxxxxxxxxx"
["created_at":protected]=>
string(20) "2018-08-13T15:49:50Z"
["tenders":protected]=>
array(1) {
[0]=>
object(SquareConnect\Model\Tender)#19 (13) {
["id":protected]=>
string(36) "2d306255-fe2e-59e9-411b-acb2bcec7a51"
["location_id":protected]=>
string(30) "xxxxxxxxxx"
["transaction_id":protected]=>
string(56) "A4ccOMcXsMJL14ZGAJUgQPqVW580zoRoGiVIQdWOgHLyXeThrKgTwLhO"
["created_at":protected]=>
string(20) "2018-08-13T15:49:50Z"
["note":protected]=>
string(18) "Online Transaction"
["amount_money":protected]=>
object(SquareConnect\Model\Money)#20 (2) {
["amount":protected]=>
int(60000)
["currency":protected]=>
string(3) "USD"
}
["tip_money":protected]=>
NULL
["processing_fee_money":protected]=>
object(SquareConnect\Model\Money)#21 (2) {
["amount":protected]=>
int(1750)
["currency":protected]=>
string(3) "USD"
}
["customer_id":protected]=>
string(30) "xxxxxxxxxx"
["type":protected]=>
string(4) "CARD"
["card_details":protected]=>
object(SquareConnect\Model\TenderCardDetails)#22 (3) {
["status":protected]=>
string(8) "CAPTURED"
["card":protected]=>
object(SquareConnect\Model\Card)#23 (8) {
["id":protected]=>
NULL
["card_brand":protected]=>
string(4) "VISA"
["last_4":protected]=>
string(4) "1111"
["exp_month":protected]=>
NULL
["exp_year":protected]=>
NULL
["cardholder_name":protected]=>
NULL
["billing_address":protected]=>
NULL
["fingerprint":protected]=>
string(64) "727f3523fa0152dbd702c84c6a9636df646d90100c305080ad7a185b954ad591"
}
["entry_method":protected]=>
string(5) "KEYED"
}
["cash_details":protected]=>
NULL
["additional_recipients":protected]=>
NULL
}
}
["refunds":protected]=>
NULL
["reference_id":protected]=>
NULL
["product":protected]=>
string(12) "EXTERNAL_API"
["client_id":protected]=>
NULL
["shipping_address":protected]=>
NULL
["order_id":protected]=>
string(56) "A4ccOMcXsMJL14ZGAJUgQPqVW580zoRoGiVIQdWOgHLyXeThrKgTwLhO"
}
}
There is no transaction id, checkout id, or other id you can matchup to verify the transaction as instructed.
The checkout_id is one of the parameters that get sent to the redirect_url. Once the checkout transaction is complete, it will automatically redirect to the url you specified (redirect_url) in the following format:
http://www.example.com/order-complete?checkoutId=xxxxxx&orderId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx
The checkoutId parameter can be compared against the id that was saved in the example that you mentioned.
References:
https://docs.connect.squareup.com/api/connect/v2#type-checkout
Related
So I am using my Express server to try update an array on my MongoDB.
My data looks like this:
{
"ID": "1",
"Name": "John",
"Image URL": "https://www.bnl.gov/today/body_pics/2017/06/stephanhruszkewycz-hr.jpg",
"Email": "",
"userSkillIds": ["1","2"]
},
{
"ID": "2",
"Name": "Sarah",
"Image URL": "https://www.venmond.com/demo/vendroid/img/avatar/big.jpg",
"Email": "",
"userSkillIds": ["3"]
},
I am trying to insert just a single String number in to the userSkillIds array using this code
router.put('/task/:id',function(req,res,next) {
var obj = req.body;
let skillId = obj.skillId;
if(obj == null || obj == {} ) {
res.status(400);
res.json({
"error": "Bad Data"
});
}else {
db.tasks.update(
{ _id: mongojs.ObjectID(req.params.id)},
{ $push: { userSkillIds: { 1: skillId } } }
)
res.json();
}
});
However I continuously get the error Error: Argument passed in must be a single String of 12 bytes or a string of 24 hex characters.
Any help would be greatly appreciated!
May be your syntax is incorrect, use push operator as follows
db.tasks.update( { _id: 1 }, { $push: { userSkillIds: 89 } } )
I get all posts from my group and I would like to publish it on my website.
When I shared something post from something fanpage - I can get everything informations about this post:
array(2) {
["data"]=>
array(11) {
[0]=>
array(13) {
["from"]=>
array(2) {
["name"]=>
string(20) "Franciszek Bonaparte"
["id"]=>
string(15) "120501615004257"
}
["name"]=>
string(11) "Funny Vines"
["description"]=>
string(25) "lol
Follow - Funny Vines"
["full_picture"]=>
string(144) "https://scontent.xx.fbcdn.net/hvthumb-xpf1/v/t15.0-10/12378449_1685955568343914_1258612246_n.jpg?oh=2878b7077fd0b69ed69a6ab1f08119d3&oe=572809E9"
["picture"]=>
string(153) "https://scontent.xx.fbcdn.net/hvthumb-xpf1/v/t15.0-10/p130x130/12378449_1685955568343914_1258612246_n.jpg?oh=43ce7f3fa54763e8dbe1fa91125a2fca&oe=57660849"
["story"]=>
string(87) "Franciszek Bonaparte udostÄpniĹ film uĹźytkownika Funny Vines w grupie Testowa Grupa."
["source"]=>
string(224) "https://video.xx.fbcdn.net/hvideo-xpl1/v/t42.1790-2/12744961_750810311722206_1464373469_n.mp4?efg=eyJybHIiOjg1NSwicmxhIjo1MTIsInZlbmNvZGVfdGFnIjoic3ZlX3NkIn0%3D&rl=855&vabr=475&oh=ccf857554a10954d543abd01b599e6b4&oe=56CC1335"
["created_time"]=>
string(24) "2016-02-21T11:16:32+0000"
["message"]=>
string(12) "test message"
["id"]=>
string(33) "1150748191602267_1155126047831148"
["likes"]=>
array(2) {
["data"]=>
array(0) {
}
["summary"]=>
array(3) {
["total_count"]=>
int(0)
["can_like"]=>
bool(true)
["has_liked"]=>
bool(false)
}
}
["comments"]=>
array(2) {
["data"]=>
array(0) {
}
["summary"]=>
array(3) {
["order"]=>
string(13) "chronological"
["total_count"]=>
int(0)
["can_comment"]=>
bool(false)
}
}
["attachments"]=>
array(1) {
["data"]=>
array(1) {
[0]=>
array(4) {
["media"]=>
array(1) {
["image"]=>
array(3) {
["height"]=>
int(640)
["src"]=>
string(144) "https://scontent.xx.fbcdn.net/hvthumb-xpf1/v/t15.0-10/12378449_1685955568343914_1258612246_n.jpg?oh=2878b7077fd0b69ed69a6ab1f08119d3&oe=572809E9"
["width"]=>
int(640)
}
}
["target"]=>
array(2) {
["id"]=>
string(16) "1271441132885072"
["url"]=>
string(71) "https://www.facebook.com/funnyvinesofficalpage/videos/1271441132885072/"
}
["type"]=>
string(12) "video_inline"
["url"]=>
string(71) "https://www.facebook.com/funnyvinesofficalpage/videos/1271441132885072/"
}
}
}
}
Here is screen of this post:
The problem is when I shared a post from user. I can't get any information about these post:
array(2) {
["data"]=>
array(12) {
[0]=>
array(6) {
["from"]=>
array(2) {
["name"]=>
string(20) "Franciszek Bonaparte"
["id"]=>
string(15) "120501615004257"
}
["created_time"]=>
string(24) "2016-02-21T11:20:50+0000"
["message"]=>
string(14) "test message 2"
["id"]=>
string(33) "1150748191602267_1155127894497630"
["likes"]=>
array(2) {
["data"]=>
array(0) {
}
["summary"]=>
array(3) {
["total_count"]=>
int(0)
["can_like"]=>
bool(true)
["has_liked"]=>
bool(false)
}
}
["comments"]=>
array(2) {
["data"]=>
array(0) {
}
["summary"]=>
array(3) {
["order"]=>
string(13) "chronological"
["total_count"]=>
int(0)
["can_comment"]=>
bool(false)
}
}
}
Here is screen of this post:
Why I can't get informations about author, shared post_id etc.? Here is my code:
$response = file_get_contents("https://graph.facebook.com/$group_id/feed?fields=from,name,shares,likes.summary(1),comments.summary(1),attachments,description,full_picture,picture,story,source,created_time,message&locale=pl_PL&limit=$limit&access_token=$token");
$array = json_decode($response, true);
Thanks for your help!
I have the following Zend_Debug value for Albums and Category in my IndexController:
array(4) {
["id"] => string(1) "1"
["artist"] => string(18) "Paula Abdul Rashid"
["title"] => string(13) "Sunny Side Up"
["category_id"] => NULL
}
array(10) {
[0] => array(2) {
["id"] => string(1) "1"
["name"] => string(7) "Country"
}
[1] => array(2) {
["id"] => string(1) "2"
["name"] => string(7) "Hip Hop"
}
[2] => array(2) {
["id"] => string(1) "3"
["name"] => string(4) "Jazz"
}
[3] => array(2) {
["id"] => string(1) "4"
["name"] => string(14) "Latin American"
}
[4] => array(2) {
["id"] => string(1) "5"
["name"] => string(3) "Pop"
}
[5] => array(2) {
["id"] => string(1) "6"
["name"] => string(3) "R&B"
}
[6] => array(2) {
["id"] => string(1) "7"
["name"] => string(4) "Rock"
}
[7] => array(2) {
["id"] => string(1) "8"
["name"] => string(3) "Ska"
}
[8] => array(2) {
["id"] => string(1) "9"
["name"] => string(5) "Asian"
}
[9] => array(2) {
["id"] => string(2) "10"
["name"] => string(11) "Modern folk"
}
}
And in my Form_Albums I have the following form elements :
$id = new Zend_Form_Element_Hidden('id');
$id->addFilter('Int');
$artist = new Zend_Form_Element_Text('artist');
$artist->setLabel('Artist')
->setRequired(true)
->addFilter('StripTags')
->addFilter('StringTrim')
->addValidator('NotEmpty');
$title = new Zend_Form_Element_Text('title');
$title->setLabel('Title')
->setRequired(true)
->addFilter('StripTags')
->addFilter('StringTrim')
->addValidator('NotEmpty');
$category = new Zend_Form_Element_Select('category');
$category->setLabel('Category')
->setRequired(true);
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$this->addElements(array($id, $artist, $title, $category, $submit));
I couldn't get the dropdownlist display using the Zend_Form_Element_Select..
Update for Solutions:
I got it working now by using the following:
$category = new Application_Model_DbTable_Category();
$category_list = $category->findForSelect();
foreach ($category_list as $cat) { //$data is your array variable
Zend_Debug::dump($cat['id']." :: ". $cat['name']);
$form->category->addMultiOption($cat['id'], $cat['name']);
}
Thanks to Rishi for opening the idea.
Something like this in your controller might help you out..
$form = new Form_Albums();
foreach ($data as $c) { //$data is your array variable
$form->category->addMultiOption($c->id, $c->name);
}
I am installing nominatim for OSM map on my own server having CENT OS with this URL as guide http://wiki.openstreetmap.org/wiki/Nominatim/Installation.
When I am executing following command to import OSM db file to pgsql:
./utils/setup.php --osm-file /usr/share/osmgeplanet/germany.osm.pbf --all
And I am getting following error:
Create DB
Create DB (2)
string(19) "pgsql://#/nominatim"
object(DB_Error)#4 (8) {
["error_message_prefix"]=>
string(0) ""
["mode"]=>
int(1)
["level"]=>
int(1024)
["code"]=>
int(-25)
["message"]=>
string(29) "DB Error: extension not found"
["userinfo"]=>
string(55) " [DB Error: extension not found] ** pgsql://#/nominatim"
["backtrace"]=>
array(7) {
[0]=>
array(6) {
["file"]=>
string(25) "/usr/local/lib/php/DB.php"
["line"]=>
int(966)
["function"]=>
string(10) "PEAR_Error"
["class"]=>
string(10) "PEAR_Error"
["type"]=>
string(2) "->"
["args"]=>
array(5) {
[0]=>
string(29) "DB Error: extension not found"
[1]=>
int(-25)
[2]=>
int(1)
[3]=>
int(1024)
[4]=>
string(32) " [DB Error: extension not found]"
}
}
[1]=>
array(7) {
["file"]=>
string(21) "/usr/lib/php/PEAR.php"
["line"]=>
int(531)
["function"]=>
string(8) "DB_Error"
["class"]=>
string(8) "DB_Error"
["object"]=>
*RECURSION*
["type"]=>
string(2) "->"
["args"]=>
array(4) {
[0]=>
int(-25)
[1]=>
int(1)
[2]=>
int(1024)
[3]=>
string(32) " [DB Error: extension not found]"
}
}
[2]=>
array(7) {
["file"]=>
string(32) "/usr/local/lib/php/DB/common.php"
["line"]=>
int(1908)
["function"]=>
string(10) "raiseError"
["class"]=>
string(4) "PEAR"
["object"]=>
object(DB_pgsql)#3 (28) {
["phptype"]=>
string(5) "pgsql"
["dbsyntax"]=>
string(5) "pgsql"
["features"]=>
array(7) {
["limit"]=>
string(5) "alter"
["new_link"]=>
string(5) "4.3.0"
["numrows"]=>
bool(true)
["pconnect"]=>
bool(true)
["prepare"]=>
bool(false)
["ssl"]=>
bool(true)
["transactions"]=>
bool(true)
}
["errorcode_map"]=>
array(0) {
}
["connection"]=>
NULL
["dsn"]=>
array(0) {
}
["autocommit"]=>
bool(true)
["transaction_opcount"]=>
int(0)
["affected"]=>
int(0)
["row"]=>
array(0) {
}
["_num_rows"]=>
array(0) {
}
["fetchmode"]=>
int(1)
["fetchmode_object_class"]=>
string(8) "stdClass"
["was_connected"]=>
NULL
["last_query"]=>
string(0) ""
["options"]=>
array(8) {
["result_buffering"]=>
int(500)
["persistent"]=>
bool(false)
["ssl"]=>
bool(false)
["debug"]=>
int(0)
["seqname_format"]=>
string(6) "%s_seq"
["autofree"]=>
bool(false)
["portability"]=>
int(0)
["optimize"]=>
string(11) "performance"
}
["last_parameters"]=>
array(0) {
}
["prepare_tokens"]=>
array(0) {
}
["prepare_types"]=>
array(0) {
}
["prepared_queries"]=>
array(0) {
}
["_last_query_manip"]=>
bool(false)
["_next_query_manip"]=>
bool(false)
["_debug"]=>
bool(false)
["_default_error_mode"]=>
NULL
["_default_error_options"]=>
NULL
["_default_error_handler"]=>
string(0) ""
["_error_class"]=>
string(8) "DB_Error"
["_expected_errors"]=>
array(0) {
}
}
["type"]=>
string(2) "->"
["args"]=>
array(7) {
[0]=>
NULL
[1]=>
int(-25)
[2]=>
NULL
[3]=>
NULL
[4]=>
string(32) " [DB Error: extension not found]"
[5]=>
string(8) "DB_Error"
[6]=>
bool(true)
}
}
[3]=>
array(7) {
["file"]=>
string(31) "/usr/local/lib/php/DB/pgsql.php"
["line"]=>
int(212)
["function"]=>
string(10) "raiseError"
["class"]=>
string(9) "DB_common"
["object"]=>
object(DB_pgsql)#3 (28) {
["phptype"]=>
string(5) "pgsql"
["dbsyntax"]=>
string(5) "pgsql"
["features"]=>
array(7) {
["limit"]=>
string(5) "alter"
["new_link"]=>
string(5) "4.3.0"
["numrows"]=>
bool(true)
["pconnect"]=>
bool(true)
["prepare"]=>
bool(false)
["ssl"]=>
bool(true)
["transactions"]=>
bool(true)
}
["errorcode_map"]=>
array(0) {
}
["connection"]=>
NULL
["dsn"]=>
array(0) {
}
["autocommit"]=>
bool(true)
["transaction_opcount"]=>
int(0)
["affected"]=>
int(0)
["row"]=>
array(0) {
}
["_num_rows"]=>
array(0) {
}
["fetchmode"]=>
int(1)
["fetchmode_object_class"]=>
string(8) "stdClass"
["was_connected"]=>
NULL
["last_query"]=>
string(0) ""
["options"]=>
array(8) {
["result_buffering"]=>
int(500)
["persistent"]=>
bool(false)
["ssl"]=>
bool(false)
["debug"]=>
int(0)
["seqname_format"]=>
string(6) "%s_seq"
["autofree"]=>
bool(false)
["portability"]=>
int(0)
["optimize"]=>
string(11) "performance"
}
["last_parameters"]=>
array(0) {
}
["prepare_tokens"]=>
array(0) {
}
["prepare_types"]=>
array(0) {
}
["prepared_queries"]=>
array(0) {
}
["_last_query_manip"]=>
bool(false)
["_next_query_manip"]=>
bool(false)
["_debug"]=>
bool(false)
["_default_error_mode"]=>
NULL
["_default_error_options"]=>
NULL
["_default_error_handler"]=>
string(0) ""
["_error_class"]=>
string(8) "DB_Error"
["_expected_errors"]=>
array(0) {
}
}
["type"]=>
string(2) "->"
["args"]=>
array(1) {
[0]=>
int(-25)
}
}
[4]=>
array(7) {
["file"]=>
string(25) "/usr/local/lib/php/DB.php"
["line"]=>
int(556)
["function"]=>
string(7) "connect"
["class"]=>
string(8) "DB_pgsql"
["object"]=>
object(DB_pgsql)#3 (28) {
["phptype"]=>
string(5) "pgsql"
["dbsyntax"]=>
string(5) "pgsql"
["features"]=>
array(7) {
["limit"]=>
string(5) "alter"
["new_link"]=>
string(5) "4.3.0"
["numrows"]=>
bool(true)
["pconnect"]=>
bool(true)
["prepare"]=>
bool(false)
["ssl"]=>
bool(true)
["transactions"]=>
bool(true)
}
["errorcode_map"]=>
array(0) {
}
["connection"]=>
NULL
["dsn"]=>
array(0) {
}
["autocommit"]=>
bool(true)
["transaction_opcount"]=>
int(0)
["affected"]=>
int(0)
["row"]=>
array(0) {
}
["_num_rows"]=>
array(0) {
}
["fetchmode"]=>
int(1)
["fetchmode_object_class"]=>
string(8) "stdClass"
["was_connected"]=>
NULL
["last_query"]=>
string(0) ""
["options"]=>
array(8) {
["result_buffering"]=>
int(500)
["persistent"]=>
bool(false)
["ssl"]=>
bool(false)
["debug"]=>
int(0)
["seqname_format"]=>
string(6) "%s_seq"
["autofree"]=>
bool(false)
["portability"]=>
int(0)
["optimize"]=>
string(11) "performance"
}
["last_parameters"]=>
array(0) {
}
["prepare_tokens"]=>
array(0) {
}
["prepare_types"]=>
array(0) {
}
["prepared_queries"]=>
array(0) {
}
["_last_query_manip"]=>
bool(false)
["_next_query_manip"]=>
bool(false)
["_debug"]=>
bool(false)
["_default_error_mode"]=>
NULL
["_default_error_options"]=>
NULL
["_default_error_handler"]=>
string(0) ""
["_error_class"]=>
string(8) "DB_Error"
["_expected_errors"]=>
array(0) {
}
}
["type"]=>
string(2) "->"
["args"]=>
array(2) {
[0]=>
array(9) {
["phptype"]=>
string(5) "pgsql"
["dbsyntax"]=>
string(5) "pgsql"
["username"]=>
string(0) ""
["password"]=>
bool(false)
["protocol"]=>
string(3) "tcp"
["hostspec"]=>
string(0) ""
["port"]=>
bool(false)
["socket"]=>
bool(false)
["database"]=>
string(9) "nominatim"
}
[1]=>
bool(false)
}
}
[5]=>
array(6) {
["file"]=>
string(47) "/home/nominati/public_html/Nominatim/lib/db.php"
["line"]=>
int(7)
["function"]=>
string(7) "connect"
["class"]=>
string(2) "DB"
["type"]=>
string(2) "::"
["args"]=>
array(2) {
[0]=>
string(19) "pgsql://#/nominatim"
[1]=>
bool(false)
}
}
[6]=>
array(4) {
["file"]=>
string(52) "/home/nominati/public_html/Nominatim/utils/setup.php"
["line"]=>
int(94)
["function"]=>
string(5) "getDB"
["args"]=>
array(0) {
}
}
}
["callback"]=>
NULL
}
DB Error: extension not found
Any solution for this?
First install the pgsql and related tools and than your import should work
For me it was line
;extension=pgsql.so
to uncomment in php.ini.
I have a Facebook Connect login at my website and I use it to get some data about my users. One thing I want to know is whether the user has been verified by Facebook. I see this in the documentation as simply the "verified" value. I've ask for some basic access params when the user authorizes my app so I think I should be able to access it. But when I try to return the value I just get a null.
My code is something like this:
if ($facebook->getSession()) {
$uid = $facebook->getUser();
$fbme = $facebook->api('/me');
} else {
$params = array(
'fbconnect'=>0,
'canvas'=>1,
'req_perms'=>'email,user_birthday,user_location,user_about_me'
);
$birthday=$fbme['birthday'];
echo "Birthday=$birthday"; //This works
$verified=$fbme['verified'];
echo "Verified=$verified"; //This just shows nothing.
Okay, vardump gives me the following. I see it in there. I guess I have to figure out how to extract it now. (Don't worry, this is a test user and I've changed some of the data so I'm not exposing any personal info here)
User #1 (Has a verified value returned):
{ ["id"]=> string(10) "1503999261" ["name"]=> string(12) "Monique Bush"
["first_name"]=> string(7) "Shane" ["last_name"]=> string(4) "Bush" ["link"]=> string(49)
"http://www.facebook.com/profile.php?id=1503999221" ["birthday"]=> string(10) "02/17/1974"
["hometown"]=> array(2) { ["id"]=> string(0) "" ["name"]=> NULL } ["location"]=> array(2)
{ ["id"]=> string(0) "" ["name"]=> NULL } ["bio"]=> string(24) "I just like to have fun!"
["gender"]=> string(6) "female" ["email"]=> string(22) "myemail#gmail.com"
["timezone"]=> int(-5) ["locale"]=> string(5) "en_US" ["verified"]=> bool(true)
["updated_time"]=> string(24) "2011-04-17T14:24:16+0000" } fbid=1503999221
User #2: (Nothing returned at all. Not even a false)
{ ["id"]=> string(15) "100003353106485" ["name"]=> string(14) "Randy Mason"
["first_name"]=> string(5) "Randy" ["last_name"]=> string(8) "Mason" ["link"]=>
string(54) "http://www.facebook.com/profile.php?id=100003353106485" ["birthday"]=>
string(10) "02/05/1985" ["work"]=> array(1) { [0]=> array(1) { ["employer"]=> array(2)
{ ["id"]=> string(15) "107572525938726" ["name"]=> string(3) "IBM" } } }
["education"]=> array(2) { [0]=> array(3) { ["school"]=> array(2) { ["id"]=> string(15)
"107705972591905" ["name"]=> string(55) "Thomas Jefferson High School for Science and
Technology" } ["year"]=> array(2) { ["id"]=> string(15) "194603703904595" ["name"]=>
string(4) "2003" } ["type"]=> string(11) "High School" } [1]=> array(3) { ["school"]=>
array(2) { ["id"]=> string(11) "56827075005" ["name"]=> string(31) "The College of
William and Mary" } ["year"]=> array(2) { ["id"]=> string(15) "142963519060927"
["name"]=> string(4) "2010" } ["type"]=> string(7) "College" } } ["gender"]=> string(4)
"male" ["email"]=> string(22) "rsmithson505#gmail.com" ["timezone"]=> int(-7)
["locale"]=> string(5) "en_US" ["updated_time"]=> string(24) "2011-12-31T22:29:34+0000" }
So I can work with this. However, I'm wondering why I don't get even a false in the second scenario.
As long as verified will be always true when account is really verified - you can just go with
$verified = !empty($fbme['verified']);