2012, the legendary doomsday, whether it’s true or not, I have a ticket to Noah’s Ark anyway…
Onlooker: http://endworld.sinaapp.com
—————————— -
This is a small application based on sae written by learning the authorization mechanism of Weibo. It uses a lot of GD functions
Now let’s make a simple learning summary
1. First create an application and apply for appkey
Sina Weibo: http://open.weibo.com
Tencent Community: http://opensns.qq.com
Tencent Weibo: http://open.t.qq.com
2. After creating the application, we next download the relevant sdk. Here we only use php as an example. The comments have been clearly written
Sina Weibo profile:
Tencent sdk: The Mahuateng thing is very painful, please download the file directly, all have comments
3. The most important thing for a good application is creativity, use your imagination Ark The boat ticket is an imitation with no new ideas, so here is a brief introduction. ① First fill in the applied appid and appkey in congfig.php or appkey.php, and then configure the callback address. ② Obtain user information, according to the user information , use PHP's gd library to generate corresponding images. Things to note when generating images are: if the user has not customized the avatar, the avatar type is png, otherwise it is jpg. If it is a zombie user, the image and nickname may not be obtained. ③ When Sina's application is not online, that is, when it fails to pass the review, only the developer's account can use the application. Other user tests can only add test users in the application management background first, and only those with more than 10 test users have a chance to pass the review. This is It’s quite a pain in the butt, but it’s still easy to pass the review ⑤ Other users can use Tencent’s application normally even if it’s not online, but it’s more difficult to pass the review. Try not to use non-theme words in the application 4. Ark Ticket File Description index.php homepage login button placement page ticket-hall.php Weibo callback page, guides users to start using ticket.php generates content to prepare for sending to Weibo toweibo.php submits data to Weibo suc.php informs the user of success
@王香宇children’s shoes question, here is the explanation:
The program involves storage and other features in SAE, so it is only applicable to sae...Cannot be used directly in ordinary space...
index.php line 31 header('Location: http://endworld.sinaapp.com/qticket-hall.php'); This is the Weibo callback address
qticket.php lines 16 and 141 can be modified to relative paths. In the same way, the pictures involved can be modified to relative paths. My personal code has a bad personality and writes absolute paths
ticket.php imagejpeg($im ,SAE_TMP_PATH.'linshi.jpg',100);//Reading and writing method: save as a temporary file, here SAE_TMP_PATH is a temporary file in SAE
ticket.php line 156 $s->upload('2012',$userid. '.jpg',SAE_TMP_PATH.'linshi.jpg');//SAEstorage is used here, see http://apidoc.sinaapp.com/sae/SaeStorage.html#upload
If there is anything that needs improvement, please feel free to share it with us
///$count: The maximum number of records returned each time, up to 200 records are returned, and the default is 50.
//$uid: Specify the user UID or Weibo nickname
//$since_id: If this parameter is specified, only Weibo messages with IDs larger than since_id (that is, Weibo messages published later than since_id) will be returned. Optional.
//$max_id: If this parameter is specified, the Weibo messages mentioning the currently logged in user with an ID less than or equal to max_id will be returned. Optional.
//$base_app: Whether to obtain data based on the current application. 1 means restricting Weibo in this application, 0 means no restrictions. Default is 0.
//$feature: Filter type ID, 0: all, 1: original, 2: pictures, 3: video, 4: music, the default is 0.
//$trim_user: Switch of user information in the return value, 0: Return complete user information, 1: User field only returns uid, default is 0.
$ms = $c->user_timeline_by_id($uid); // done
///////////////////
//Get the list of Weibo information posted by the user
//$screen_name: Weibo Nickname is mainly used to distinguish the user UID from the Weibo nickname. When the two are the same and there is ambiguity, it is recommended to use this parameter
?>
Sina Weibo V2 interface demonstration program- Powered by Sina App Engine
=$user_message['screen_name']?>,Hello!
Send new Weibo
///////////////
//Post a WeChat Bo information.
//update ($status, $lat latitude, $long longitude, $annotations facilitate third parties to record data such as array("a"=>"b", "c"=>"d")) )
// $status: Weibo information to be updated. The information content does not exceed 140 Chinese characters, and a 400 error is returned if it is empty.
//$pic_path: The path of the picture to be published, supports url. Only png/jpg/gif formats are supported.
//$lat: latitude, the geographical location of the current Weibo post, the valid range is -90.0 to +90.0, + means northern latitude. Optional.
//$long: Optional parameter, longitude. The valid range is -180.0 to +180.0, + represents east longitude.Optional
$status='Publish picture on Weibo test April 23, 2012 14:25:43';
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn