Twitter Bot PHP
1.0.0
PHP를 사용한 미디어와 함께 상태를 자동으로 업데이트하기위한 Twitter 봇.
트위터 개발자 계정에 앱을 등록하십시오
개발자 페이지에서 응용 프로그램을 등록하십시오. 소비자 비밀을 밝히지 마십시오. 이제 소비자 키 , 소비자 비밀 , 액세스 토큰 및 액세스 토큰 비밀이 있습니다.
Codebird-Php를 다운로드하십시오
Codebird를 사용하여 Twitter REST API, 스트리밍 API, COLLECTION API, TON (Object Nest) API 및 Twitter Ads API에 연결하여 하나의 라이브러리를 사용합니다. Codebird는 Application 전용 인증뿐만 아니라 전체 3 방향 OAuth를 지원합니다.
여기 또는 여기에서 다운로드 할 수 있습니다
메시지 보내기 : 메시지 보내기 그룹 또는 채널로 보내기 :
$ ApiKey = < API_KEY >;
$ ApiSecretKey = < API_SECRET_KEY >;
$ AccessToken = < ACCESS_TOKEN >;
$ AccessTokenSecret = < ACCESS_TOKEN_SECRET >;
// add the codebird library
require_once ( ' codebird/src/codebird.php ' );
Codebird Codebird:: setConsumerKey ( $ ApiKey , $ ApiSecretKey );
$ cb = Codebird Codebird:: getInstance ();
$ cb -> setToken ( $ AccessToken , $ AccessTokenSecret );
//build an array of images to send to twitter
$ reply = $ cb -> media_upload ( array (
' media ' => < IMAGE_URL > or < IMAGE_URI >
));
//upload the file to your twitter account
$ mediaID = $ reply -> media_id_string ;
// implode mandatory only for multile media uploads
$ params = array (
' status ' => " #message " ,
' media_ids ' => implode ( ' , ' , [ $ mediaID ]) // optional
);
//post the tweet with codebird
$ reply = $ cb -> statuses_update ( $ params );
function get_content ( $ URL )
{
$ ch = curl_init ();
curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , 1 );
curl_setopt ( $ ch , CURLOPT_URL , $ URL );
$ data = curl_exec ( $ ch );
curl_close ( $ ch );
return $ data ;
}
내 일에 감사한다면, 저를 재충전하기 위해 컵을 사는 것을 고려해보십시오. PayPal에 의해
Copyright 2020 MyInnos
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.