2017-09-05 64 views
-1

我想从pre风格的身体获取数据,但我无法做到这一点请你请帮助我!vba代码从网址前体的数据获取数据

下面是我从身体所需要的数据。

{"response": {"objects": [["natural_light", 612, 881, 1124, 1118]]}, "error": "false"} 

我的html代码: -

<html> 
 
<head></head> 
 
<body> 
 
<pre style="word-wrap: break-word; white-space: pre-wrap;"> 
 
{"response": {"objects": [["natural_light", 612, 881, 1124, 1118]]}, "error": "false"} 
 
</pre> 
 
</body> 
 
</html>

回答

-1

<html> 
 
<head></head> 
 
<body> 
 
<pre style="word-wrap: break-word; white-space: pre-wrap;"> 
 
{"response": {"objects": [["natural_light", 612, 881, 1124, 1118]]}, "error": "false"} 
 
</pre> 
 
</body> 
 
</html>

Sub test() 
 
Dim xhr As MSXML2.XMLHTTP60 
 
Dim doc As MSHTML.HTMLDocument 
 
Dim results As MSHTML.HTMLDivElement 
 
Dim elt As MSHTML.HTMLTableCell 
 
Dim imgs As MSHTML.IHTMLElementCollection 
 
Dim img As MSHTML.HTMLImg 
 
Set xhr = New MSXML2.XMLHTTP60 
 
With xhr 
 
.Open "GET", "https://api.restb.ai/segmentation client_key=c529e4cb36fd71a0038e5790fd69a42eacaf378fa0789bba78b9782e073b88ed&model_id=re_features&image_url=https://www.mulderteam.com/wp-content/blogs.dir/234/files/2013/04/110922317.jpg", False 
 
.send 
 
If .readyState = 4 And .Status = 200 Then 
 
Set doc = New MSHTML.HTMLDocument 
 
doc.body.innerHTML = .responseText 
 
End If 
 
End With 
 
End Sub

我的VBA代码: -