The WordPress HTTP API makes fetching from or posting to remote servers a breeze. It does this by allowing you to be transport agnostic when you fetch or post something. The HTTP API will choose the fastest and most reliable method out of the five different transports available in PHP. It’ll take care of discovering what transports are allowed on that server at that time.
The two most important functions and the ones you will probably use 99% of the time are:
wp_remote_get().wp_remote_post().
$body = wp_remote_retrieve_body( wp_remote_get( 'http://mysite.com/' ) );
WordPress HTTP API 使用指南
本文介绍了WordPress HTTP API的功能,该API允许开发者以运输方式不可知的方式从远程服务器获取或发布数据。它会自动选择最快的传输方式,并允许使用wp_remote_get()和wp_remote_post()两个主要函数来处理大部分请求。
356

被折叠的 条评论
为什么被折叠?



