[PHP]WordPress HTTP API

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/' ) );


發佈了270 篇原創文章 · 獲贊 3 · 訪問量 15萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章