Jump to content

$oXML.Send worked for years and now throws error


KF5WGB
 Share

Go to solution Solved by KaFu,

Recommended Posts

 

Hi everybody,

I looked through the forum and some guys, way way back, had the same problem but iI can not find a solution. I used this Function for years without a problem and now it throws an error. The attached pic is from running the compiled .exe file. Running the Func SolarData() itself gives the $oXML^ ERROR .

SolarData()

Func SolarData()
    ;If _IsInternetConnected() = True Then
        Global $oXML = ObjCreate("Microsoft.XMLHTTP")
        $oXML.Open("GET", "http://www.hamqsl.com/solarxml.php", 0)
        $oXML.Send

        ; Find Sunspots
        $SSCount1 = StringInStr($oXML.responsetext, "<sunspots")
        $SSCount2 = StringInStr($oXML.responsetext, "</sunspots")
        $SSlen = $SSCount2 - ($SSCount1 + 10)
        Global $SS = StringMid($oXML.responsetext, ($SSCount1 + 10), $SSlen)

        ; Find SolarFlux
        $SFCount1 = StringInStr($oXML.responsetext, "<solarflux")
        $SFCount2 = StringInStr($oXML.responsetext, "</solarflux")
        $FSlen = $SFCount2 - ($SFCount1 + 11)
        Global $SFI = StringMid($oXML.responsetext, ($SFCount1 + 11), $FSlen)

        ;Find A index
        $AiCount1 = StringInStr($oXML.responsetext, "<aindex")
        $AICount2 = StringInStr($oXML.responsetext, "</aindex")
        $AIlen = $AICount2 - ($AiCount1 + 8)
        Global $AI = StringMid($oXML.responsetext, ($AiCount1 + 8), $AIlen)

        ;Find K index
        $KICount1 = StringInStr($oXML.responsetext, "<kindex")
        $KICount2 = StringInStr($oXML.responsetext, "</kindex")
        $KIlen = $KICount2 - ($KICount1 + 8)
        Global $KI = StringMid($oXML.responsetext, ($KICount1 + 8), $KIlen)

;~      TrayItemSetText($SolarFlux, "Solar Data: SSN:" & $SS & " SFI:" & $SFI & "  A:" & $AI & "  K:" & $KI)
    ;EndIf
EndFunc   ;==>SolarData

C:\Users\KF5WGB\Desktop\nextcloud copy\A2Q+_Dev\solardata.au3" (19) : ==> The requested action with this object has failed.:
$oXML.Send
$oXML^ ERROR

Is this obsolete or did M$ change something on how to create XML objects?
Global $oXML = ObjCreate("Microsoft.XMLHTTP")
        $oXML.Open("GET", "http://www.hamqsl.com/solarxml.php", 0)
        $oXML.Send

Thanks for any advice.

73 de KF5WGB

$oXML error.png

Link to comment
Share on other sites

  • Solution

https://stackoverflow.com/questions/46247627/excel-vba-send-to-msxml2-xmlhttp-does-not-work

This works for me:

SolarData()

Func SolarData()
    ;If _IsInternetConnected() = True Then
        Global $oXML = ObjCreate("MSXML2.ServerXMLHTTP")
        $oXML.Open("GET", "http://www.hamqsl.com/solarxml.php",0)
        $oXML.Send

        ; Find Sunspots
        $SSCount1 = StringInStr($oXML.responsetext, "<sunspots")
        $SSCount2 = StringInStr($oXML.responsetext, "</sunspots")
        $SSlen = $SSCount2 - ($SSCount1 + 10)
        Global $SS = StringMid($oXML.responsetext, ($SSCount1 + 10), $SSlen)

        ; Find SolarFlux
        $SFCount1 = StringInStr($oXML.responsetext, "<solarflux")
        $SFCount2 = StringInStr($oXML.responsetext, "</solarflux")
        $FSlen = $SFCount2 - ($SFCount1 + 11)
        Global $SFI = StringMid($oXML.responsetext, ($SFCount1 + 11), $FSlen)

        ;Find A index
        $AiCount1 = StringInStr($oXML.responsetext, "<aindex")
        $AICount2 = StringInStr($oXML.responsetext, "</aindex")
        $AIlen = $AICount2 - ($AiCount1 + 8)
        Global $AI = StringMid($oXML.responsetext, ($AiCount1 + 8), $AIlen)

        ;Find K index
        $KICount1 = StringInStr($oXML.responsetext, "<kindex")
        $KICount2 = StringInStr($oXML.responsetext, "</kindex")
        $KIlen = $KICount2 - ($KICount1 + 8)
        Global $KI = StringMid($oXML.responsetext, ($KICount1 + 8), $KIlen)

      ; TrayItemSetText($SolarFlux, "Solar Data: SSN:" & $SS & " SFI:" & $SFI & "  A:" & $AI & "  K:" & $KI)
      MsgBox(0,"","Solar Data: SSN:" & $SS & " SFI:" & $SFI & "  A:" & $AI & "  K:" & $KI)
    ;EndIf
EndFunc   ;==>SolarData

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...