网站优化

网站优化

Products

当前位置:首页 > 网站优化 >

使用用户名/密码Wordpress到其他源休息呼叫

GG网络技术分享 2025-03-18 16:12 3


问题描述:

I have been asked to create some custom content on a wordpress site, basically just some web app stuff (html/css/js), but leveraging data from another source via restcalls. There is a service account un/pwd required, and I am wondering what is best practice/approach in terms of the cross site calls with this un? The wire is encrypted but I certainly don\'t want to store the creds on the client (wordpress admin stuff). I am assuming there is a mechanism to store such on the \'back-end\', filesystem, but I am not even sure such access exists? How you get to this....I have gone through the wordpress admin board and haven\'t found anything that provides access to the filesystem/php files, etc. Perhaps I am not looking in the right place or after the wrong bits?

I have googled but am such a noob with wordpress I am not even sure I have the right approach in mind; any help/advice is greatly appreciated.

EDIT: so if curl is the standard approach for this type of thing, where/how am I able to access the filesystem/php? Is there a specific place this type if thing lives or a convention of where it is placed? Just help with some 101 direction please.

图片转代码服务由CSDN问答提供

感谢您的意见,我们尽快改进~

功能建议

我被要求在wordpress网站上创建一些自定义内容,基本上只是一些网络应用程序的东西(html / css) / js),但通过restcalls利用来自其他来源的数据。 有一个服务帐户un / pwd是必需的,我想知道什么是使用此联合国的跨站点呼叫的最佳实践/方法? 电线是加密的,但我当然不想将信用卡存储在客户端上(wordpress管理员的东西)。 我假设有一种机制可以存储在\'后端\',文件系统,但我甚至不确定这种访问是否存在? 你是如何达到这个....我已经通过wordpress管理板,并没有找到任何提供访问文件系统/ PHP文件等的东西。也许我没有找到正确的地方或错误的位后? </ p>

我用Google搜索了,但是我是一个诺言的wordpress,我甚至不确定我是否有正确的方法; 非常感谢任何帮助/建议。</ p>

编辑:所以如果curl是这种类型的标准方法,我在哪里/如何访问文件系统/ php? 如果事物存在或者放置它的惯例,这个类型是否有特定的地方? 请帮助101方向。</ p>

</ div>

网友观点:

First things first, you will need to develop a plugin for WordPress to properly hook into everything and play nice with everyone else. There are many tutorials for getting started. Here\'s one that integrates with an API

If you have to store things to make your plugin integrate with this third party, you should use the Options API that WP provides to you, with the information set from a settings page. Please don\'t hardcode that into a file somewhere in the code. (I\'ll also mention if you need something more powerful than the plugin options, you can add custom tables)

Now we have code running on WordPress with the information it needs, now it needs to do something. To pull the information from this third party, we can use PHP cURL.

Last, depending on how we want this information to end up being consumed by the user. We can do something simply such as just fetching/injecting the data during a regular WP page load on our custom page. Or we could be fancier and set up a WP REST API endpoint that re-serves the information we got from the 3rd party. Shortcodes? Widgets? Custom Templates? Filter Hooks? There is a lot of ways to present our final interface to the user.

标签:

提交需求或反馈

Demand feedback