SlideShare uma empresa Scribd logo
1 de 13
Baixar para ler offline
WP HTTP API Eunus Hosen! 
Co-Founder & CTO! 
DevsTeam
What is HTTP API
Why HTTP API 
❖ cURL : A library to communicate with remote hosts. Works only 
when the cURL extension is loaded into PHP.! 
❖ File system (fopen, file_get_contents) : This function opens up a file 
or an URL and this works when php ini_settings allows for this.! 
❖ Sockets (fsockopen) : Initiates a socket connection to the resource 
specified by host-name. Again it’s possible that the hosting company 
might have disabled the fsockopen function.! 
❖ Streams: Works on PHP 4.3 or later.! 
❖ HTTP: Provides a powerful request and parallel interface for remote 
calls. It needs PHP 5.2+
WP_HTTP Class
Helper Functions 
❖ wp_remote_get() - Retrieves a URL using the GET HTTP 
method.! 
❖ wp_remote_post() - Retrieves a URL using the POST HTTP 
method.! 
❖ wp_remote_head() - Retrieves a URL using the HEAD 
HTTP method.! 
❖ wp_remote_request() - Retrieves a URL using either the 
default GET or a custom HTTP method (should be caps) 
that you specify.
An Example
Response
Retrieve Body: wp_remote_retrieve_body($response)
Retrieve Body: wp_remote_retrieve_headers($response)
More Helper Functions 
❖ wp_remote_retrieve_body() - Retrieves just the body from the response.! 
❖ wp_remote_retrieve_header() - Gives you a single HTTP header based 
on name from the response.! 
❖ wp_remote_retrieve_headers() - Returns all of the HTTP headers in an 
array for processing.! 
❖ wp_remote_retrieve_response_code() - Gives you the number for the 
HTTP response. This should be 200, but could be 4xx or even 3xx on 
failure.! 
❖ wp_remote_retrieve_response_message() - Returns the response 
message based on the response code
Resources 
❖ wp_remote_get: http://codex.wordpress.org/Function_Reference/wp_remote_get! 
❖ wp_remote_post: http://codex.wordpress.org/Function_Reference/wp_remote_post! 
❖ wp_remote_head: http://codex.wordpress.org/Function_Reference/wp_remote_head! 
❖ wp_remote_retrieve_body : http://codex.wordpress.org/Function_Reference/ 
wp_remote_retrieve_body! 
❖ wp_remote_retrieve_headers : http://codex.wordpress.org/Function_Reference/ 
wp_remote_retrieve_headers! 
❖ wp_remote_retrieve_header: http://codex.wordpress.org/Function_Reference/ 
wp_remote_retrieve_header! 
❖ wp_remote_retrieve_response_code : http://codex.wordpress.org/Function_Reference/ 
wp_remote_retrieve_response_code! 
❖ wp_remote_retrieve_response_message : http://codex.wordpress.org/Function_Reference/ 
wp_remote_retrieve_response_message
Got a Question?
Thank you!

Mais conteúdo relacionado

Mais procurados

Php Server Var
Php Server VarPhp Server Var
Php Server Vararvind34
 
eZ Publish Cluster Unleashed
eZ Publish Cluster UnleashedeZ Publish Cluster Unleashed
eZ Publish Cluster UnleashedBertrand Dunogier
 
PHP language presentation
PHP language presentationPHP language presentation
PHP language presentationAnnujj Agrawaal
 
[India Merge World Tour] Meru Networks
[India Merge World Tour] Meru Networks[India Merge World Tour] Meru Networks
[India Merge World Tour] Meru NetworksPerforce
 
Internationalization with TYPO3
Internationalization with TYPO3Internationalization with TYPO3
Internationalization with TYPO3digiparden GmbH
 
Intro KaKao MRTE (MySQL Realtime Traffic Emulator)
Intro KaKao MRTE (MySQL Realtime Traffic Emulator)Intro KaKao MRTE (MySQL Realtime Traffic Emulator)
Intro KaKao MRTE (MySQL Realtime Traffic Emulator)I Goo Lee
 
Introduction to Symfony Components and helper components in Drupal 8
Introduction to Symfony Components and helper components in Drupal 8Introduction to Symfony Components and helper components in Drupal 8
Introduction to Symfony Components and helper components in Drupal 8Ankit Babbar
 
Oracle database - Get external data via HTTP, FTP and Web Services
Oracle database - Get external data via HTTP, FTP and Web ServicesOracle database - Get external data via HTTP, FTP and Web Services
Oracle database - Get external data via HTTP, FTP and Web ServicesKim Berg Hansen
 
Heavy Web Optimization: Backend
Heavy Web Optimization: BackendHeavy Web Optimization: Backend
Heavy Web Optimization: BackendVõ Duy Tuấn
 
Apache web server installation/configuration, Virtual Hosting
Apache web server installation/configuration, Virtual HostingApache web server installation/configuration, Virtual Hosting
Apache web server installation/configuration, Virtual Hostingwebhostingguy
 
WordPress Theme & Plugin development best practices - phpXperts seminar 2011
WordPress Theme & Plugin development best practices - phpXperts seminar 2011WordPress Theme & Plugin development best practices - phpXperts seminar 2011
WordPress Theme & Plugin development best practices - phpXperts seminar 2011Tareq Hasan
 

Mais procurados (20)

Psr 7 symfony-day
Psr 7 symfony-dayPsr 7 symfony-day
Psr 7 symfony-day
 
Php workshop L04 database
Php workshop L04 databasePhp workshop L04 database
Php workshop L04 database
 
Php workshop L03 superglobals
Php workshop L03 superglobalsPhp workshop L03 superglobals
Php workshop L03 superglobals
 
Php Server Var
Php Server VarPhp Server Var
Php Server Var
 
eZ Publish Cluster Unleashed
eZ Publish Cluster UnleashedeZ Publish Cluster Unleashed
eZ Publish Cluster Unleashed
 
PHP language presentation
PHP language presentationPHP language presentation
PHP language presentation
 
[India Merge World Tour] Meru Networks
[India Merge World Tour] Meru Networks[India Merge World Tour] Meru Networks
[India Merge World Tour] Meru Networks
 
File Uploading in PHP
File Uploading in PHPFile Uploading in PHP
File Uploading in PHP
 
Internationalization with TYPO3
Internationalization with TYPO3Internationalization with TYPO3
Internationalization with TYPO3
 
Intro KaKao MRTE (MySQL Realtime Traffic Emulator)
Intro KaKao MRTE (MySQL Realtime Traffic Emulator)Intro KaKao MRTE (MySQL Realtime Traffic Emulator)
Intro KaKao MRTE (MySQL Realtime Traffic Emulator)
 
Php 5.5
Php 5.5Php 5.5
Php 5.5
 
Real-Time Django
Real-Time DjangoReal-Time Django
Real-Time Django
 
Introduction to Symfony Components and helper components in Drupal 8
Introduction to Symfony Components and helper components in Drupal 8Introduction to Symfony Components and helper components in Drupal 8
Introduction to Symfony Components and helper components in Drupal 8
 
Varnish
VarnishVarnish
Varnish
 
Caching on the Edge
Caching on the EdgeCaching on the Edge
Caching on the Edge
 
Uploading a file with php
Uploading a file with phpUploading a file with php
Uploading a file with php
 
Oracle database - Get external data via HTTP, FTP and Web Services
Oracle database - Get external data via HTTP, FTP and Web ServicesOracle database - Get external data via HTTP, FTP and Web Services
Oracle database - Get external data via HTTP, FTP and Web Services
 
Heavy Web Optimization: Backend
Heavy Web Optimization: BackendHeavy Web Optimization: Backend
Heavy Web Optimization: Backend
 
Apache web server installation/configuration, Virtual Hosting
Apache web server installation/configuration, Virtual HostingApache web server installation/configuration, Virtual Hosting
Apache web server installation/configuration, Virtual Hosting
 
WordPress Theme & Plugin development best practices - phpXperts seminar 2011
WordPress Theme & Plugin development best practices - phpXperts seminar 2011WordPress Theme & Plugin development best practices - phpXperts seminar 2011
WordPress Theme & Plugin development best practices - phpXperts seminar 2011
 

Destaque

WordPress Coding Standards & WP Hooks
WordPress Coding Standards & WP HooksWordPress Coding Standards & WP Hooks
WordPress Coding Standards & WP HooksEunus Hosen
 
Introduction to Web Development Career
Introduction to Web Development CareerIntroduction to Web Development Career
Introduction to Web Development CareerEunus Hosen
 
Career on WordPress: How to get started with WordPress
Career on WordPress: How to get started with WordPressCareer on WordPress: How to get started with WordPress
Career on WordPress: How to get started with WordPressEunus Hosen
 
2014 (1) debriefing
2014 (1) debriefing2014 (1) debriefing
2014 (1) debriefingUma Chitra
 
Branding highlights2002b
Branding highlights2002bBranding highlights2002b
Branding highlights2002bgdamon1010
 
Brocher ciri guru inovatif
Brocher ciri guru inovatifBrocher ciri guru inovatif
Brocher ciri guru inovatifUma Chitra
 
Apec women and the economy 2011 mo - australia
Apec women and the economy 2011   mo - australiaApec women and the economy 2011   mo - australia
Apec women and the economy 2011 mo - australiaotoolem
 
An example of cms - wordpress
An example of cms - wordpressAn example of cms - wordpress
An example of cms - wordpressEunus Hosen
 
Jeres powerpoint
Jeres powerpointJeres powerpoint
Jeres powerpointnikorayer
 
Women and the economy
Women and the economyWomen and the economy
Women and the economyotoolem
 
Introduction to WordPress
Introduction to WordPressIntroduction to WordPress
Introduction to WordPressEunus Hosen
 

Destaque (17)

WordPress Coding Standards & WP Hooks
WordPress Coding Standards & WP HooksWordPress Coding Standards & WP Hooks
WordPress Coding Standards & WP Hooks
 
Introduction to Web Development Career
Introduction to Web Development CareerIntroduction to Web Development Career
Introduction to Web Development Career
 
Career on WordPress: How to get started with WordPress
Career on WordPress: How to get started with WordPressCareer on WordPress: How to get started with WordPress
Career on WordPress: How to get started with WordPress
 
Premio Ramazzini & Carvalho
Premio  Ramazzini & CarvalhoPremio  Ramazzini & Carvalho
Premio Ramazzini & Carvalho
 
CV-Malawi
CV-MalawiCV-Malawi
CV-Malawi
 
Unique engineering
Unique engineeringUnique engineering
Unique engineering
 
2014 (1) debriefing
2014 (1) debriefing2014 (1) debriefing
2014 (1) debriefing
 
Branding highlights2002b
Branding highlights2002bBranding highlights2002b
Branding highlights2002b
 
Brocher ciri guru inovatif
Brocher ciri guru inovatifBrocher ciri guru inovatif
Brocher ciri guru inovatif
 
Lp week 1
Lp week 1Lp week 1
Lp week 1
 
Fan Page Biz-In-A-Box
Fan Page Biz-In-A-BoxFan Page Biz-In-A-Box
Fan Page Biz-In-A-Box
 
Apec women and the economy 2011 mo - australia
Apec women and the economy 2011   mo - australiaApec women and the economy 2011   mo - australia
Apec women and the economy 2011 mo - australia
 
An example of cms - wordpress
An example of cms - wordpressAn example of cms - wordpress
An example of cms - wordpress
 
Jeres powerpoint
Jeres powerpointJeres powerpoint
Jeres powerpoint
 
Protokoler
ProtokolerProtokoler
Protokoler
 
Women and the economy
Women and the economyWomen and the economy
Women and the economy
 
Introduction to WordPress
Introduction to WordPressIntroduction to WordPress
Introduction to WordPress
 

Semelhante a WP HTTP API Guide - Methods and Functions

nguyenhainhathuy-building-restful-web-service
nguyenhainhathuy-building-restful-web-servicenguyenhainhathuy-building-restful-web-service
nguyenhainhathuy-building-restful-web-servicehazzaz
 
REST library.pptx
REST library.pptxREST library.pptx
REST library.pptxMSivani
 
Salesforce Integration using REST SOAP and HTTP callouts
Salesforce Integration using REST SOAP and HTTP calloutsSalesforce Integration using REST SOAP and HTTP callouts
Salesforce Integration using REST SOAP and HTTP calloutsRAMNARAYAN R
 
New Features in PHP 5.3
New Features in PHP 5.3New Features in PHP 5.3
New Features in PHP 5.3Bradley Holt
 
Future of HTTP in CakePHP
Future of HTTP in CakePHPFuture of HTTP in CakePHP
Future of HTTP in CakePHPmarkstory
 
MidwestPHP Symfony2 Internals
MidwestPHP Symfony2 InternalsMidwestPHP Symfony2 Internals
MidwestPHP Symfony2 InternalsRaul Fraile
 
Php 7 compliance workshop singapore
Php 7 compliance workshop singaporePhp 7 compliance workshop singapore
Php 7 compliance workshop singaporeDamien Seguy
 
GettingStartedWithPHP
GettingStartedWithPHPGettingStartedWithPHP
GettingStartedWithPHPNat Weerawan
 
OpenTravel Advisory Forum 2012 REST XML Resources
OpenTravel Advisory Forum 2012 REST XML ResourcesOpenTravel Advisory Forum 2012 REST XML Resources
OpenTravel Advisory Forum 2012 REST XML ResourcesOpenTravel Alliance
 
Writing and using php streams and sockets tek11
Writing and using php streams and sockets   tek11Writing and using php streams and sockets   tek11
Writing and using php streams and sockets tek11Elizabeth Smith
 
Tips
TipsTips
Tipsmclee
 
Master the New Core of Drupal 8 Now: with Symfony and Silex
Master the New Core of Drupal 8 Now: with Symfony and SilexMaster the New Core of Drupal 8 Now: with Symfony and Silex
Master the New Core of Drupal 8 Now: with Symfony and SilexRyan Weaver
 
RESTful for opentravel.org by HP
RESTful for opentravel.org by HPRESTful for opentravel.org by HP
RESTful for opentravel.org by HPRoni Schuetz
 
PHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckPHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckrICh morrow
 
PHP MySQL Training : Module 3
PHP MySQL Training : Module 3PHP MySQL Training : Module 3
PHP MySQL Training : Module 3hussulinux
 
Under the Covers with the Web
Under the Covers with the WebUnder the Covers with the Web
Under the Covers with the WebTrevor Lohrbeer
 

Semelhante a WP HTTP API Guide - Methods and Functions (20)

nguyenhainhathuy-building-restful-web-service
nguyenhainhathuy-building-restful-web-servicenguyenhainhathuy-building-restful-web-service
nguyenhainhathuy-building-restful-web-service
 
REST library.pptx
REST library.pptxREST library.pptx
REST library.pptx
 
Salesforce Integration using REST SOAP and HTTP callouts
Salesforce Integration using REST SOAP and HTTP calloutsSalesforce Integration using REST SOAP and HTTP callouts
Salesforce Integration using REST SOAP and HTTP callouts
 
New Features in PHP 5.3
New Features in PHP 5.3New Features in PHP 5.3
New Features in PHP 5.3
 
Future of HTTP in CakePHP
Future of HTTP in CakePHPFuture of HTTP in CakePHP
Future of HTTP in CakePHP
 
Web services tutorial
Web services tutorialWeb services tutorial
Web services tutorial
 
Web Services Tutorial
Web Services TutorialWeb Services Tutorial
Web Services Tutorial
 
MidwestPHP Symfony2 Internals
MidwestPHP Symfony2 InternalsMidwestPHP Symfony2 Internals
MidwestPHP Symfony2 Internals
 
Php 7 compliance workshop singapore
Php 7 compliance workshop singaporePhp 7 compliance workshop singapore
Php 7 compliance workshop singapore
 
GettingStartedWithPHP
GettingStartedWithPHPGettingStartedWithPHP
GettingStartedWithPHP
 
OpenTravel Advisory Forum 2012 REST XML Resources
OpenTravel Advisory Forum 2012 REST XML ResourcesOpenTravel Advisory Forum 2012 REST XML Resources
OpenTravel Advisory Forum 2012 REST XML Resources
 
Writing and using php streams and sockets tek11
Writing and using php streams and sockets   tek11Writing and using php streams and sockets   tek11
Writing and using php streams and sockets tek11
 
Tips
TipsTips
Tips
 
Master the New Core of Drupal 8 Now: with Symfony and Silex
Master the New Core of Drupal 8 Now: with Symfony and SilexMaster the New Core of Drupal 8 Now: with Symfony and Silex
Master the New Core of Drupal 8 Now: with Symfony and Silex
 
RESTful for opentravel.org by HP
RESTful for opentravel.org by HPRESTful for opentravel.org by HP
RESTful for opentravel.org by HP
 
PHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckPHP from soup to nuts Course Deck
PHP from soup to nuts Course Deck
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
Key features PHP 5.3 - 5.6
Key features PHP 5.3 - 5.6Key features PHP 5.3 - 5.6
Key features PHP 5.3 - 5.6
 
PHP MySQL Training : Module 3
PHP MySQL Training : Module 3PHP MySQL Training : Module 3
PHP MySQL Training : Module 3
 
Under the Covers with the Web
Under the Covers with the WebUnder the Covers with the Web
Under the Covers with the Web
 

Último

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 

Último (20)

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 

WP HTTP API Guide - Methods and Functions

  • 1. WP HTTP API Eunus Hosen! Co-Founder & CTO! DevsTeam
  • 3. Why HTTP API ❖ cURL : A library to communicate with remote hosts. Works only when the cURL extension is loaded into PHP.! ❖ File system (fopen, file_get_contents) : This function opens up a file or an URL and this works when php ini_settings allows for this.! ❖ Sockets (fsockopen) : Initiates a socket connection to the resource specified by host-name. Again it’s possible that the hosting company might have disabled the fsockopen function.! ❖ Streams: Works on PHP 4.3 or later.! ❖ HTTP: Provides a powerful request and parallel interface for remote calls. It needs PHP 5.2+
  • 5. Helper Functions ❖ wp_remote_get() - Retrieves a URL using the GET HTTP method.! ❖ wp_remote_post() - Retrieves a URL using the POST HTTP method.! ❖ wp_remote_head() - Retrieves a URL using the HEAD HTTP method.! ❖ wp_remote_request() - Retrieves a URL using either the default GET or a custom HTTP method (should be caps) that you specify.
  • 10. More Helper Functions ❖ wp_remote_retrieve_body() - Retrieves just the body from the response.! ❖ wp_remote_retrieve_header() - Gives you a single HTTP header based on name from the response.! ❖ wp_remote_retrieve_headers() - Returns all of the HTTP headers in an array for processing.! ❖ wp_remote_retrieve_response_code() - Gives you the number for the HTTP response. This should be 200, but could be 4xx or even 3xx on failure.! ❖ wp_remote_retrieve_response_message() - Returns the response message based on the response code
  • 11. Resources ❖ wp_remote_get: http://codex.wordpress.org/Function_Reference/wp_remote_get! ❖ wp_remote_post: http://codex.wordpress.org/Function_Reference/wp_remote_post! ❖ wp_remote_head: http://codex.wordpress.org/Function_Reference/wp_remote_head! ❖ wp_remote_retrieve_body : http://codex.wordpress.org/Function_Reference/ wp_remote_retrieve_body! ❖ wp_remote_retrieve_headers : http://codex.wordpress.org/Function_Reference/ wp_remote_retrieve_headers! ❖ wp_remote_retrieve_header: http://codex.wordpress.org/Function_Reference/ wp_remote_retrieve_header! ❖ wp_remote_retrieve_response_code : http://codex.wordpress.org/Function_Reference/ wp_remote_retrieve_response_code! ❖ wp_remote_retrieve_response_message : http://codex.wordpress.org/Function_Reference/ wp_remote_retrieve_response_message