开发者

PHP classes totally forgotten something today - sorry

开发者 https://www.devze.com 2023-01-03 11:47 出处:网络
really sorry about being \"totally thick today\" but I have forgotten how to do something simple - too much time not in php recently.

really sorry about being "totally thick today" but I have forgotten how to do something simple - too much time not in php recently.

Want to use the OS phpapi How do I print out the individual rows - see told you I was being thick today

 // The fields we will be fetching.


 if (isset($_GET['test']) && $_GET['test'] == 'plaxo') {
    // plaxo is a Port开发者_运维百科ableContacts end-point so doesn't know about the OpenSocial specific fields
    $profile_fields = array();
  } else {
    $profile_fields = array(
        'aboutMe',
        'displayName',
        'bodyType',
        'currentLocation',
        'drinker',
        'happiestWhen',
        'lookingFor'
    );
  }

// The number of friends to fetch.

  $friend_count = 2;

$batch = $osapi->newBatch();
    // Fetch the current user.
      $self_request_params = array(
          'userId' => $userId,              // Person we are fetching.
          'groupId' => '@self',             // @self for one person.
          'fields' => $profile_fields       // Which profile fields to request.
      );
  $batch->add($osapi->people->get($self_request_params), 'self');

  // Fetch the friends of the user
  $friends_request_params = array(
      'userId' => $userId,              // Person whose friends we are fetching.
      'groupId' => '@friends',          // @friends for the Friends group.
      'fields' => $profile_fields,      // Which profile fields to request.
      'count' => $friend_count          // Max friends to fetch.
  );
  $batch->add($osapi->people->get($friends_request_params), 'friends');

  // Get supportedFields Request
  $batch->add($osapi->people->getSupportedFields(), 'supportedFields');

  // Send the batch request.
  $result = $batch->execute();

Say I wanted to print out "aboutMe", whats the echo? cos echo $result['aboutMe'] doesn't work.


While I am far from a php expert and admittedly know nothing about the specific product you are using I find that using var_dump($result) helps a lot with debugging.

0

精彩评论

暂无评论...
验证码 换一张
取 消