|
...
|
...
|
@@ -14,7 +14,13 @@ class AyrShare |
|
|
|
public $api_key = 'G8GQW3X-XBTMGXW-QPDDZ9A-WE1Z5SB';
|
|
|
|
//系统设置
|
|
|
|
public $config = [
|
|
|
|
|
|
|
|
'facebook'=>'#best https://www.facebook.com',
|
|
|
|
'google'=>'#best https://www.google.com',
|
|
|
|
'instagram'=>'#best https://www.instagram.com',
|
|
|
|
'linkedin'=>'#best https://www.linkedin.com',
|
|
|
|
'twitter'=>'#best https://www.twitter.com',
|
|
|
|
'telegram'=>'#best https://www.telegram.com',
|
|
|
|
'tiktok'=>'#bestvideo',
|
|
|
|
];
|
|
|
|
//profile_key
|
|
|
|
public $profile_key = '';
|
|
...
|
...
|
@@ -86,18 +92,7 @@ zFePUMXy1bFghAfzNKlrc5XgH4ixeeMh3cDtU97K |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :(获取当前用户的配置文件)get_profiles
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/5/6 16:01
|
|
|
|
*/
|
|
|
|
public function get_profiles(){
|
|
|
|
$url = $this->path.'/api/profiles';
|
|
|
|
return $this->http_click('get',$url,[]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :(获取所有用户的配置文件)get_profiles_users
|
|
|
|
* @name :(获取指定api_key的配置文件)get_profiles_users
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/5/6 16:44
|
|
...
|
...
|
@@ -107,21 +102,47 @@ zFePUMXy1bFghAfzNKlrc5XgH4ixeeMh3cDtU97K |
|
|
|
$url = $this->path.'/api/user';
|
|
|
|
return $this->http_click('get',$url,[],$this->headers);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :(通过用户名获取社交账号)get_brand_user
|
|
|
|
* @author :lyh https://app.ayrshare.com/api/brand/byUser
|
|
|
|
* @name :(发帖)post_send_msg
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/5/5 17:32
|
|
|
|
* @time :2023/5/8 9:22
|
|
|
|
* @param :platforms: "facebook", "fbg", "twitter",
|
|
|
|
* "linkedin", "instagram","youtube", "reddit" ,"telegram""
|
|
|
|
*/
|
|
|
|
public function get_brand_user($param){
|
|
|
|
//[[platforms=>'instagram','instagramUser'=>'user']]
|
|
|
|
$str = '';
|
|
|
|
foreach ($param as $k =>$v){
|
|
|
|
//platforms[0]=instagram&platforms[1]=twitter&twitterUser=ayrshare&instagramUser=nygiants',
|
|
|
|
public function post_send_msg($param){
|
|
|
|
$param = [
|
|
|
|
'post'=>$param['post'],//内容(帖子文本)
|
|
|
|
'platforms'=>$param['platforms'],//平台
|
|
|
|
'idempotencyKey'=>$param['idempotencyKey'],//帖子唯一id
|
|
|
|
'mediaUrls'=>$param['mediaUrls'],
|
|
|
|
];
|
|
|
|
//平台参数处理
|
|
|
|
$this->headers['Accept-Encoding'] = 'gzip';
|
|
|
|
$this->headers['Authorization'] = $this->headers['Authorization'].$param['profile_key'];
|
|
|
|
$url = $this->path.'/api/post';
|
|
|
|
return $this->http_click('posts',$url,$param,$this->headers);
|
|
|
|
}
|
|
|
|
$url = $this->path.'/api/brand/byUser?'.$str;
|
|
|
|
return $this->http_click('get',$url);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :(上传图片或视频到ayr_share)post_media_upload
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/5/8 9:47
|
|
|
|
* https://app.ayrshare.com/api/media/upload
|
|
|
|
*/
|
|
|
|
public function post_media_upload($data){
|
|
|
|
$param = [
|
|
|
|
'file'=>$data['file'],//base64编码
|
|
|
|
'fileName'=>$data['file_name'],//生成图片名称
|
|
|
|
'description'=>$data['description'],//描述
|
|
|
|
];
|
|
|
|
$this->headers['Authorization'] = $this->headers['Authorization'].$data['profile_key'];
|
|
|
|
$url = $this->path.'/api/media/upload';
|
|
|
|
return $this->http_click('posts',$url,$param,$this->headers);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :获取过去30天发布的历史记录(1-30)
|
|
|
|
* @author :lyh
|
...
|
...
|
|