Reading HTML from a URL via VBScript

I came accross and interesting question in the SalesLogix Business Partner newsgroups. Someone needed to read the return from a webpage from a SalesLogix VBScript. They were trying to use the WebBrowser control and pull the HTML returned after setting the URL (which you can’t do with the SLX WebBrowser control). Anyway, XMLHTTP is the right way to do this.

If all you want to do is read what is returned from a URL then use something like XMLHTTP from the MS XML parser to read the data from the URL. Here’s a sample that will read the HTML from Google.com and place the results in a TextBox.

 

Dim objHttp

Set objHttp = CreateObject("Msxml2.ServerXMLHTTP")
objHttp.Open "GET", "http://www.google.com/", False

objHttp.Send
Text1.Text = objHttp.ResponseText
Set objHttp = Nothing

 

ABOUT THE AUTHOR

Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. His new passion for CRM is Creatio, formerly bpm'online. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

1 Comment

  1. Thanks Ryan, I’ve been trying four other scripts to get an ASPX page called… to switch an RS232 actuator…. to switch my ligths on/off…. your’s did it. Regards Rouan – South Africa

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!