本文介绍了如何从VB6与服务器端PHP API进行通信?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是关于VB6和服务器端PHP之间的通信的问题。

This is a question about communication between VB6 and server-side PHP.

WooCommerce有一个插件,可以让你序列化软件产品的销售。它通过PHP API与软件应用程序通信。 API调用的语法如下:

WooCommerce has a plugin that lets you serialize sales of software products. It communications to software applications via a PHP API. The syntax of an API call is like this:

wp_get_request('http://174.120.19.162/~fab/?wc_api=software_api&request=request_key&Secret_Key=<sekret>&email=<email>')



I have a VB6 application that needs to communicate with this api. I am using the following code to send the URL request:

blah = INetObject.OpenURL("http://174.120.19.162/~fab/wp_get_request('http://174.120.19.162/~fab/?wc_api=software_api&request=request_key&Secret_Key=<sekret>&email=<email>')")

API应该返回一个JSON对象(blah),然后我解析它以获取我想要的数据。但它不起作用。我尝试了各种语法排列无济于事。大多数情况下,我得到目标页面的XML描述,所以我的问题是:

The API is supposed to return a JSON object (blah) which I then parse to get the data I want. However it is not working. I've tried various syntactical permutations to no avail. Mostly I get an XML description of the destination page, so my question is this:

如何从VB6与此API通信?我已经在这个问题上工作了大约一个星期而没有结果。

How do I communicate to this API from VB6? I've been working this issue for about a week with no results.

推荐答案

你混淆了在wordPress代码内部使用的API,以及你需要从外部调用的内容。

You're confusing the API to be used internally in wordPress code, and what you need to call externally.

此示例由您提供并调用WordPress内部的函数来发出HTTP请求:

This sample was given by you and calls a function internal to WordPress to make the HTTP request:

wp_get_request('http://174.120.19.162/~fab/?wc_api=software_api&request=request_key&Secret_Key=<sekret>&email=<email>')

VB6中 wp_get_request()的等价物将是 INetObject.OpenURL()

The equivalant of the wp_get_request() in VB6 would be INetObject.OpenURL():

blah = INetObject.OpenURL('http://174.120.19.162/~fab/?wc_api=software_api&request=request_key&Secret_Key=<sekret>&email=<email>')

你的错误是试图将两者混合在一起,认为 wp_get_request 是HTTP API本身的一部分。

Your mistake was trying to mash the two together, thinking wp_get_request was part of the HTTP API itself.

这篇关于如何从VB6与服务器端PHP API进行通信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 06:33