Abhay
Abhay

Reputation: 6760

Parse Facebook Graph getGraphEdge Array

How to parse this array in php?

$graphNode = $response->getGraphEdge();

Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => Haridwar
            [id] => 108165019208093
        )

)
Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => Haridwar - देवभूमि हरिद्वार
            [id] => 1421343878181284
        )

)
Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => Haridwar , Rishikesh
            [id] => 422468281161935
        )

)
Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => Harkipodi, Haridwar
            [id] => 1729854440364388
        )

)
Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => Haridwar, Uttrakhand
            [id] => 271122532995757
        )

)
Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => Haridwar Harki Poudi
            [id] => 407948889585330
        )

)
Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => Hari Ki Paudi, Haridwar
            [id] => 1408036495920326
        )

)
Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => Hotel Haridwar
            [id] => 499032723507426
        )

)
Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => Haridwar Residency
            [id] => 553955321295065
        )

)
Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => Haridwar + Rishikesh
            [id] => 332726176855030
        )

)
Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => Koti Scoops
            [id] => 511614448958675
        )

)
Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => Haridwar Junction railway station
            [id] => 362403983924849
        )

)
Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => Haridwar district
            [id] => 104069102963739
        )

)
Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => Acharyakulam, Haridwar
            [id] => 450267691725152
        )

)
Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => Haridwar, Uttarakhand
            [id] => 169553733566933
        )

)
Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => Patanjali Yogpeeth, Haridwar
            [id] => 852886484794187
        )

)
Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => Haridwar.
            [id] => 321176964637111
        )

)
Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => हर की पौड़ी - Haridwar
            [id] => 1322823121134475
        )

)
Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => Haridwar city
            [id] => 107543295960409
        )

)
Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => Shantikunj, Haridwar
            [id] => 112797876037151
        )

)
Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => Haridwar N Mansuri...
            [id] => 237523539684453
        )

)
Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => Ganges
            [id] => 107615949267735
        )

)
Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => Haridwar : The City Of Love & Nature
            [id] => 1172065216231819
        )

)
Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => Wave Cinemas Haridwar
            [id] => 1597030567189676
        )

)
Facebook\GraphNodes\GraphNode Object
(
    [items:protected] => Array
        (
            [name] => Shahastradhara Deharadun Uttrakhand
            [id] => 1456909874548716
        )

)

Upvotes: 2

Views: 563

Answers (1)

Abhay
Abhay

Reputation: 6760

Thanks Guys, I got the answer it's asArray() method on getGraphEdge.

 $response->getGraphEdge()->asArray();

Upvotes: 7

Related Questions