Классы PHP совершенно забыли что-то сегодня - извините - PullRequest
0 голосов
/ 10 июня 2010

очень жаль, что я сегодня "абсолютно толстый", но я забыл, как сделать что-то простое - слишком много времени в php.

Хотите использовать ОС phpapi Как распечатать отдельные строки - смотрите, я говорил вам, что я сегодня толстый

 // The fields we will be fetching.


 if (isset($_GET['test']) && $_GET['test'] == 'plaxo') {
    // plaxo is a PortableContacts 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'
    );
  }

// Количество друзей для выборки.

  $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();

Скажи, что я хотел распечатать "aboutMe", что это за эхо? cos echo $ result ['aboutMe'] не работает.

1 Ответ

1 голос
/ 10 июня 2010

Хотя я далеко не эксперт по php и, по общему признанию, ничего не знаю о конкретном продукте, который вы используете, я обнаружил, что использование var_dump($result) очень помогает при отладке.

...