XMLHTTP problems

L_P

New Member
Joined
Dec 3, 2011
Messages
3
I'm trying to extract data from some webpages. I'm pulling in the html with an XMLHTTP object and extracting the desired information with Regex.

The following code works fine for vanilla ".html" pages:
Code:
    Dim pageHTML As String
    Dim oXMLHTTP As Object
    Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.6.0")
    :
    :
    oXMLHTTP.Open "GET", urlString, False
    oXMLHTTP.send ""
            
    If oXMLHTTP.Status <> 200 Then
        errorStr = oXMLHTTP.statusText
        GoTo HandleError
    Else
        htmlStr= oXMLHTTP.responseText
    End If
In that case, I get the full html code into htmlStr, whence I can extract the desired info.



:mad: BUT :mad:


When I try it on other sorts of pages, such as .asp and .php, all I get in oXMLHTTP.responseText is a "html" tag.

I'm trying to parse simple pages - ones that take no variables or parameters. E.g.: http://www.quoteland.com/random.asp . I just want to get back the html code that shows up as the page source in my browser when I surf to such sites.


After several hours of searching the web, all I've been able to come up with is that maybe I need to do something with setRequestHeader. Or maybe I need some sort of "POST" rather than "GET". Or something.

Nowhere have I been able to find a simple explanation of the XMLHTTP functionality, nor instructions on how I need to configure the object in order to get the HTML code generated by .asp, .php, and similarly flavored URLs.



Um.... HELP?!!! :confused:


Thanks,
LP
 

excel-yes

New Member
Joined
May 10, 2011
Messages
9
"Nowhere have I been able to find a simple explanation of the XMLHTTP functionality"

Tell me about it!!! I found out about it a couple of days ago and the only thing online I can find are "this is how to go to a page and get the results" ??? I don't think hardly any of the experts even know how to use xmlhttp in vba. Frustrating!
 

Forum statistics

Threads
1,082,259
Messages
5,364,098
Members
400,779
Latest member
lumers

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top