当前位置: 首页>>代码示例>>PHP>>正文


PHP TwitterAPIExchange::resetFields方法代码示例

本文整理汇总了PHP中TwitterAPIExchange::resetFields方法的典型用法代码示例。如果您正苦于以下问题:PHP TwitterAPIExchange::resetFields方法的具体用法?PHP TwitterAPIExchange::resetFields怎么用?PHP TwitterAPIExchange::resetFields使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TwitterAPIExchange的用法示例。


在下文中一共展示了TwitterAPIExchange::resetFields方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

// FOLLOW BACK FOLLOWERS
// Get followers ids
$url = 'https://api.twitter.com/1.1/followers/ids.json';
$getfield = '?screen_name=EmergencyPipou';
$requestMethod = 'GET';
$followers = $twitter->setGetfield($getfield)->buildOauth($url, $requestMethod)->performRequest();
$followers = json_decode($followers);
$followerIds = array();
foreach ($followers->ids as $i => $id) {
    $followerIds[] = $id;
}
// Get followers list
$url = 'https://api.twitter.com/1.1/followers/list.json';
$getfield = '?screen_name=EmergencyPipou';
$requestMethod = 'GET';
$followersList = $twitter->resetFields()->setGetfield($getfield)->buildOauth($url, $requestMethod)->performRequest();
$followersList = json_decode($followersList);
$followersList = $followersList->users;
// Get friends
$url = 'https://api.twitter.com/1.1/friends/ids.json';
$getfield = '?screen_name=EmergencyPipou';
$requestMethod = 'GET';
$friends = $twitter->resetFields()->setGetfield($getfield)->buildOauth($url, $requestMethod)->performRequest();
$friends = json_decode($friends);
$friendIds = array();
foreach ($friends->ids as $i => $id) {
    $friendIds[] = $id;
}
// Follow followers that are not friends
foreach ($followerIds as $id) {
    if (!in_array($id, $friendIds)) {
开发者ID:WhiteFangs,项目名称:EmergencyPipou,代码行数:31,代码来源:EmergencyPipou.php

示例2: getCURLOutput

 $requestURL = 'http://api.art.rmngp.fr:80/v1/works?exists=images%2Ctitle.fr&per_page=1&page=' . $randomPage;
 $result = getCURLOutput($requestURL, $RmnAPIKey);
 if (isset($result->hits) && count($result->hits->hits) > 0) {
     $work = $result->hits->hits[0]->_source;
     // Upload image of the work
     foreach ($work->images as $image) {
         if ($image->default) {
             $photographerCredit = $image->photographer->name;
             if (isset($image->permalink)) {
                 $permalink = $image->permalink;
             }
             $imageContent = file_get_contents($image->urls->original);
             $imageData = base64_encode($imageContent);
             $postfields = array('media_data' => $imageData);
             $requestMethod = "POST";
             $response = $twitter->resetFields()->buildOauth($mediaUploadURL, $requestMethod)->setPostfields($postfields)->performRequest();
             $response = json_decode($response);
             if (isset($response->media_id_string)) {
                 $mediaId = $response->media_id_string;
             }
         }
     }
     if (!isset($mediaId)) {
         return false;
     }
     // Build tweet
     // Set max string length based on Twitter config
     $maxLength = 140 - $twitterConfig->characters_reserved_per_media - strlen(' / ' . $photographerCredit);
     if (isset($permalink)) {
         $maxLength -= $twitterConfig->short_url_length + 1;
     }
开发者ID:WhiteFangs,项目名称:ImagesDArtBot,代码行数:31,代码来源:ImagesDArtBot.php


注:本文中的TwitterAPIExchange::resetFields方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。