Need to identify difference in the output of fqlquery and json decoding

I have a database table that has facebook page url, page id and status. I need to update the status field with Yes or No depending on whether the facebook page is verified or not. I have taken the fql approach (i know its no more now) still. It works because I have an old facebook app. Here is the query outputs json object returning true or false

FQL Query https://graph.facebook.com/fql?q=SELECT is_verified FROM page WHERE page_id="115332808485663"

Link to view query in browser

Here I have taken an example of NokiaIndia facebook page. It is a verified page and the above query returns true in brower but when i do it in php, it says its not verified. I think I have some thing wrong in the below code that needs to be identified. Please help.

$url=$row["url"]; $pageid=$row["page_id"]; $fqlAPIParams = array( 'method' => 'fql.query', 'query' =>' SELECT is_verified FROM page WHERE page_id = '.$pageid.' LIMIT 99999' , 'access_token'=>$token ); $result = $facebook->api($fqlAPIParams); if( $result->is_verified ){ $verified="Yes"; } else { $verified="No"; } echo $pageid; echo "<br>"; echo $verified;

Here is the output of the code. Since the page in example is verified, it should show Yes ! Please help....

115332808485663 No

-------------Problems Reply------------

I guess you should be checking the "is_verified" field, but you are checking "verified".

It should be:

if( $result->is_verified ){
$verified="Yes";
} else {
$verified="No";
}

Being having very little knowledge of arrays, json and programming, Tired a lot of combinations and finally got it to work. The problem was here

if( $result[0]['is_verified'] ){

Category:php Views:0 Time:2014-11-03

Related post

  • how to output multiple entity to JSON from WCF REST 2011-07-22

    I'm working on WCF REST services. How do I output Multiple entity to JSON? Here is my code: [OperationContract] [WebGet(UriTemplate = "TimeService/GetAllCourses", ResponseFormat = WebMessageFormat.Json)] public IList<Semester> GetAllCourses() {

  • Qt: difference between moc output in debug and release? 2008-10-09

    Using the Qt Visual studio integration, adding a new Qt class adds two separate moc.exe generated files - one for debug and one for release (and one for any other configuration currently existing). Yet the two eventual generated files seem to be iden

  • Difference between "sort < output" and "sort output" 2011-09-05

    I just want to know the difference between: sort < output and sort output in Linux. How does it work exactly? --------------Solutions------------- This has been discussed on unix.stackexchange here: Performance difference between stdin and command

  • VB: Check Row Position to identify sections for text output A123 B123 R123 etc 2012-12-13

    UPDATE: note that this work is a basis for speeding up work as part of a larger macro / vb. i don't think it is apparent the amount of time it will save in moving around faster than you can say operating system. thanks. ========== NOTE TO MS: i use w

  • identify differences in two excel 2010 spreadsheets 2014-07-28

    I have 2 Excel 2010 spreadsheets - one old, one new. I want to identify in the new spreadsheet what's missing as compared to the old, and what's new as compared to the old. Any suggestions? --------------Solutions------------- Use a helper column plu

  • Fastest way to identify differences between two tables? 2010-02-18

    I have a need to check a live table against a transactional archive table and I'm unsure of the fastest way to do this... For instance, let's say my live table is made up of these columns: Term CRN Fee Level Code My archive table would have the same

  • `-` or `-` is there any difference in HTML output? 2010-11-09

    &mdash; or — Is there a difference between these? Is one better-supported than the other? --------------Solutions------------- SGML parsers (or XML parsers in the case of XHTML) can handle — without having to process the DTD (which doesn't matter

  • Difference in the output in Java 2011-05-27

    I have one program in java..i am confused about the output. public static void main(String args[]) { int n=0; for(int m=0; m<5;m++) { n=n++; System.out.println(n); } } here output is 0 0 0 0 0 But if i write, public static void main(String args[])

  • difference between diff outputs using "git add --patch" and "filemerge" 2011-06-03

    I'm trying to use git add --patch, and I noticed that it's diffs aren't the same as those generated using opendiff. Is this common? Are there different diff algorithms? Am I just nuts? Assuming the above is "yes", is there a way to force git to use t

  • Why there's difference between the output of these 2 code snippets? 2011-11-12

    Snippet 1: <% _message.InnerText = this.GetType().ToString(); %> <h3>Page type: <span id=_message runat=server/></h3> Snippet 2: <h3>Page type: <span id=_message runat=server/></h3> <% _message.InnerText =

  • Date Differences from different outputs 2012-02-23

    I try to find out how long it takes till a customer orders again in my eshop. Name of the list eshop_flat_sales_order customer_email created_at status ------------------------------------ a(at)a.com 12.1.10 complete b(at)a.com 14.2.10 cancelled c(at)

  • How can I suppress \\ in my output from Perl's JSON module? 2009-10-14

    Following code always print paths with double slashes: use JSON; use File::Spec; my $installdir = $ENV{"ProgramFiles"}; my $xptrlc = File::Spec->catfile($installdir,"bin","sample"); my $jobhash; my $return_packet; $jobhash->{'PATH'} = $xptrlc;

  • How to output javascript Date in json 2010-06-30

    I am trying to the timeline chart: http://code.google.com/apis/visualization/documentation/gallery/annotatedtimeline.html#Data_Format Data is coming in the form of a JSON feed. Google wants the data as something like this: { version:'0.6', reqId:'0',

  • Output Multiple values in JSON from WCF 2011-07-14

    I created a WCF Restful service. I retrieve data from nHibernate. I'm using nHibernate's GetAll function to get all the data. How do I out put all the data in JSON? Here is my code: [OperationContract] [WebGet(UriTemplate = "TimeService/GetAllLanguag

  • jquery each only outputting first iteration of JSON 2011-08-21

    Using this code: $.each(data.toptracks.track, function(index, item){ $('.lastfm').append('<figure class="clearfix"><p><a href="'+item.url+'">'+item.name+'</a>'+item.artist.name+'</p><div class="vinyl"><img class

  • Difference between .put() and .element() methods in JSON? 2012-02-23

    I am trying to create json object for my data. i found that, i can do that using two methods :- put() and element() please suggest me, which should be used. my data is for example :- key="id" value=32 Thanks in advance !! --------------Solutions-----

  • How do I output Jade content through JSON? (Node.js) 2012-02-24

    I wrote a video gallery web app a few months ago in CodeIgniter and I'm trying to move the back end to Node, using Express + Jade to produce the content. The PHP version sends JSON to the front end, often including a substantial chunk of HTML. I'd li

  • How to output an Array as JSON? 2012-03-03

    I have the following: @array.inspect ["x1", "x2", "adad"] I would like to be able to format that to: client.send_message(s, m, {:id => "x1", :id => "x2", :id => "adad" }) client.send_message(s, m, ???????) How can I have the @array output in

  • False output of function: Base 64 decoding in C 2014-05-15

    (I found the decoding function on the internet) /* Macro definitions */ #define TABLELEN 63 #define BUFFFERLEN 128 #define ENCODERLEN 4 #define ENCODEROPLEN 0 #define ENCODERBLOCKLEN 3 #define PADDINGCHAR '=' #define BASE64CHARSET "ABCDEFGHIJKLMNOPQR

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.302 (s). 11 q(s)