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
JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,
Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.
The enumeration function in PHP8.1 enhances the clarity and type safety of the code by defining named constants. 1) Enumerations can be integers, strings or objects, improving code readability and type safety. 2) Enumeration is based on class and supports object-oriented features such as traversal and reflection. 3) Enumeration can be used for comparison and assignment to ensure type safety. 4) Enumeration supports adding methods to implement complex logic. 5) Strict type checking and error handling can avoid common errors. 6) Enumeration reduces magic value and improves maintainability, but pay attention to performance optimization.
The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.
Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...
How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...