从其他站点检索XML和/或JSON数据

时间:2021-11-07 15:40:41

Good morning everyone,

大家,早安,

I recently got a request if it's possible to retrieve data from other sites search results. I tried searching, but didn't exactly know how to word my searching.

我最近得到了一个请求,如果有可能从其他网站检索搜索结果的数据。我试着搜索,但并不知道怎么说我的搜索。

Best explained by example.

最好用例子解释。

Visit: https://bcbst.vitalschoice.com/professional?search_specialty_id=29&ci=DFT&geo_location=33688&network_id=39&sort=relevancy&radius=any&page=1

You'll see a list of doctors.

你会看到一份医生名单。

I'm looking for a way to programmatically get the list of doctors. Like the name, address, phone.

我正在寻找一种以编程方式获取医生名单的方法。喜欢的名字,地址,电话。

I just need some direction as I will probably be doing this for multiple sites.

我只是需要一些方向,因为我可能会为多个站点做这个。

I program in C# and JS.

我用C#和JS编程。

1 个解决方案

#1


1  

In the case of the website you linked it has an API available for use. What you can do is make an AJAX request (if using JQuery) or WebRequest (if using C#) to one of the endpoints, and then convert the JSON you get from the website into whatever you need to use.

对于您链接的网站,它有一个可供使用的API。您可以做的是向其中一个端点发出AJAX请求(如果使用JQuery)或WebRequest(如果使用C#),然后将从网站获得的JSON转换为您需要使用的任何内容。

You can test what you'll be getting back from the server by typing the url into the browser, example

您可以通过在浏览器中键入url来测试从服务器返回的内容,例如

As for the search parameters, you'll have to add those to the url. I'd advise taking a look at their API to see what functions they support.

至于搜索参数,您必须将这些参数添加到网址中。我建议看看他们的API,看看他们支持哪些功能。

Hope this helps!

希望这可以帮助!

#1


1  

In the case of the website you linked it has an API available for use. What you can do is make an AJAX request (if using JQuery) or WebRequest (if using C#) to one of the endpoints, and then convert the JSON you get from the website into whatever you need to use.

对于您链接的网站,它有一个可供使用的API。您可以做的是向其中一个端点发出AJAX请求(如果使用JQuery)或WebRequest(如果使用C#),然后将从网站获得的JSON转换为您需要使用的任何内容。

You can test what you'll be getting back from the server by typing the url into the browser, example

您可以通过在浏览器中键入url来测试从服务器返回的内容,例如

As for the search parameters, you'll have to add those to the url. I'd advise taking a look at their API to see what functions they support.

至于搜索参数,您必须将这些参数添加到网址中。我建议看看他们的API,看看他们支持哪些功能。

Hope this helps!

希望这可以帮助!