Heim  >  Artikel  >  php教程  >  [PHP]WordPress HTTP API

[PHP]WordPress HTTP API

WBOY
WBOYOriginal
2016-06-06 19:59:091321Durchsuche

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


Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:高级PHP应用程序漏洞审核技术Nächster Artikel:PHP Navigator