簡體   English   中英

通過移動應用與Wordpress網站API進行交互

[英]Interacting with Wordpress website API from mobile app

我正在開發一個帶有登錄屏幕的應用程序,其中包含通常的用戶名和密碼文本輸入。

當按“登錄”按鈕時,該代碼應向Wordpress網站發出HTTP Web請求,以嘗試登錄。

我看過名為JSON APIJSON API USER的WP插件,但是文檔非常有限。

我將如何正確登錄到Wordpress網站以及如何從數據庫中檢索用戶信息?

注意:我正在Xamarin中進行開發,但是來自任何語言的任何代碼示例都可以,因為我可以輕松移植代碼。

要連接到Wordpress網站的系統並與之交互,您確實需要進行一些API調用。

使用插件JSON APIJSON API USER是最簡單的方法。

  1. 從網站控制面板安裝JSON APIJSON API USER插件
  2. 一次接一個Web請求,以使用以下調用獲取現時和獲得授權cookie:

隨機數: http://www.mywordpresswebsite.com/api/get_nonce/?controller=user&method=generate_auth_cookie&insecure=cool ://www.mywordpresswebsite.com/api/get_nonce/?controller http://www.mywordpresswebsite.com/api/get_nonce/?controller=user&method=generate_auth_cookie&insecure=cool user&method http://www.mywordpresswebsite.com/api/get_nonce/?controller=user&method=generate_auth_cookie&insecure=cool generate_auth_cookie&insecure http://www.mywordpresswebsite.com/api/get_nonce/?controller=user&method=generate_auth_cookie&insecure=cool cool

身份驗證Cookie: http://www.mywordpresswebsite.com/api/user/generate_auth_cookie/?username=USERNAME_HERE&password=PASSWORD_HERE&insecure=cool ://www.mywordpresswebsite.com/api/user/generate_auth_cookie/?username http://www.mywordpresswebsite.com/api/user/generate_auth_cookie/?username=USERNAME_HERE&password=PASSWORD_HERE&insecure=cool USERNAME_HERE&password http://www.mywordpresswebsite.com/api/user/generate_auth_cookie/?username=USERNAME_HERE&password=PASSWORD_HERE&insecure=cool PASSWORD_HERE&insecure= http://www.mywordpresswebsite.com/api/user/generate_auth_cookie/?username=USERNAME_HERE&password=PASSWORD_HERE&insecure=cool

注意:

在請求結束時,您可以看到參數insecure=cool

這用於不安全的通信。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM