最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugins - How to get data from a private API and add it to wordpress pages

programmeradmin0浏览0评论

I got a private API (Cliniko) I want for example the full list of clients to be listed where I want on a page. I know how APIs work, what I don't know is how to implement them in Wordpress.

Is there a plugin that can help me do it? Or, what's the better way to do it?

And yes I have searched google up to page 10(and clicked almost every single link) I have seen lots of guides or maybe things that can work but nothing consistent, and almost everything that could be good is at least 3 years old, that's why I'm asking here, so please don't be *****. Thank you very much for any help, that's very much appreciated.

I got a private API (Cliniko) I want for example the full list of clients to be listed where I want on a page. I know how APIs work, what I don't know is how to implement them in Wordpress.

Is there a plugin that can help me do it? Or, what's the better way to do it?

And yes I have searched google up to page 10(and clicked almost every single link) I have seen lots of guides or maybe things that can work but nothing consistent, and almost everything that could be good is at least 3 years old, that's why I'm asking here, so please don't be *****. Thank you very much for any help, that's very much appreciated.

Share Improve this question asked Apr 21, 2019 at 14:34 Steacy PaquetteSteacy Paquette 13 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

You can fetch data using wp_remote_get().

//API URL
$url = 'your api url';

// API RESPONSE
$response = wp_remote_get($url, "your headers goes here / use array to set multiple headers.");

you can then access content from $response.

$response['body']; // will give you content.

wrap it with your own function name and add this code in your functions.php file. Call the function from your custom page template file.

发布评论

评论列表(0)

  1. 暂无评论