Reading web content (may be RSS)2019 Community Moderator ElectionExtract XML info from feed?Issues in Getting RSS/ATOM using javascriptParsing RSS - but following a link in it, to get images from the linked pageTrying to get data from Rss feed from crickInfo website but no luckRead youtube channel xml file with c# xmldocumentMaking a dynamic RSS feed from external XML fileXML with text tags getting prematurely un-encoded when transformed in XSLT 1.0Download and include referenced URL in XMLTrouble parsing just img src from RSS feed?Control index.xml for Atom/RSS to generate valid rss feed (without relative links)

Can hydraulic brake levers get hot when brakes overheat?

Official degrees of earth’s rotation per day

How to explain that I do not want to visit a country due to personal safety concern?

Happy pi day, everyone!

Can anyone tell me why this program fails?

Making a sword in the stone, in a medieval world without magic

How to simplify this time periods definition interface?

What is the greatest age difference between a married couple in Tanach?

How do I hide Chekhov's Gun?

Make a transparent 448*448 image

Replacing Windows 7 security updates with anti-virus?

Did CPM support custom hardware using device drivers?

Rules about breaking the rules. How do I do it well?

Does the statement `int val = (++i > ++j) ? ++i : ++j;` invoke undefined behavior?

Bash replace string at multiple places in a file from command line

At what level can a dragon innately cast its spells?

Informing my boss about remarks from a nasty colleague

Does splitting a potentially monolithic application into several smaller ones help prevent bugs?

Why would a flight no longer considered airworthy be redirected like this?

An Accountant Seeks the Help of a Mathematician

Why are the outputs of printf and std::cout different

Pinhole Camera with Instant Film

Co-worker team leader wants to inject his friend's awful software into our development. What should I say to our common boss?

What has been your most complicated TikZ drawing?



Reading web content (may be RSS)



2019 Community Moderator ElectionExtract XML info from feed?Issues in Getting RSS/ATOM using javascriptParsing RSS - but following a link in it, to get images from the linked pageTrying to get data from Rss feed from crickInfo website but no luckRead youtube channel xml file with c# xmldocumentMaking a dynamic RSS feed from external XML fileXML with text tags getting prematurely un-encoded when transformed in XSLT 1.0Download and include referenced URL in XMLTrouble parsing just img src from RSS feed?Control index.xml for Atom/RSS to generate valid rss feed (without relative links)










1















I was able to read dynamic information from a website through the second link (commented out in the code below). If I uncomment the second line it works fine, and I get the information I want. If I use the first link it doesn't work; the file that gets generated is 0 bytes.



The first time you might have to press some button and run the script again (depends on browser). So how to get the desired result? I need the ETA, the one at the top: Arrival">ETA</a> : March 23, 2019 </td></tr> </table>.



_RSSGetInfo() didn't work either (the shipper indicates it is an XML RSS feed, but I don't know whether this is the right thing to use; it gave me a blank).



#include <MsgBoxConstants.au3>
#include <IE.au3>
#include <Array.au3>
#include <Date.au3>
#include <String.au3>
#include <Excel.au3>
#include <WinAPIFiles.au3>

$Link = "http://wcf.mscgva.ch/publicasmx/Tracking.asmx/GetRSSTrackingByContainerNumber?ContainerNumber=MSCU4727397"
;$Link = "https://www.hapag-lloyd.com/en/online-business/tracing/tracing-by-booking.html?blno=HLCUEUR1810BCLY1"

$file = fileopen(@ScriptDir & "XYZ.txt", 2 + 8)
$IE = _IECreate($Link, 0, 1, 1, 1)

Sleep(2000)
$source = _IEDocReadHTML($IE)
FileWrite($file, $source)

MsgBox(0, "Source", $source)


Here is the RSSInfo version, which gives me a blank (I found this on the internet, and edited it) :



#include <MsgBoxConstants.au3>
#include <IE.au3>
#include <Array.au3>
#include <Date.au3>
#include <String.au3>
#include <Excel.au3>
#include <WinAPIFiles.au3>

#include-once
#region _RSS
; RSS Reader
; Created By: Frostfel
#include <INet.au3>
#include <Array.au3>

; ============================================================================
; Function: _RSSGetInfo($RSS, $RSS_InfoS, $RSS_InfoE[, $RSS_Info_ = 1])
; Description: Gets RSS Info
; Parameter(s): $RSS = RSS Feed Example: "http://feed.com/index.xml"
; $RSS_InfoS = String to find for info start Example: <title>
; $RSS_InfoE = String to find for info end Example: </title>
; $RSS_Info_Start = [optional] <info>/</info> To start at
; Some RSS feeds will have page titles
; you dont want Defualt = 0
; Requirement(s): None
; Return Value(s): On Success - Returns RSS Info in Array Starting at 1
; On Failure - Returns 0
; @Error = 1 - Failed to get RSS Feed
; Author(s): Frostfel
; ============================================================================
Func _RSSGetInfo($RSS, $RSS_InfoS, $RSS_InfoE, $RSS_Info_Start = 0)
$RSSFile = _INetGetSource($RSS)
If @Error Then
SetError(1)
Return -1
EndIf
Dim $InfoSearchS = 1
Dim $Info[1000]
Dim $InfoNumA
$InfoNum = $RSS_Info_Start
While $InfoSearchS <> 6
$InfoNum += 1
$InfoNumA += 1
$InfoSearchS = StringInStr($RSSFile, $RSS_InfoS, 0, $InfoNum)
$InfoSearchE = StringInStr($RSSFile, $RSS_InfoE, 0, $InfoNum)
$InfoSearchS += 6
$InfoSS = StringTrimLeft($RSSFile, $InfoSearchS)
$InfoSearchE -= 1
$InfoSE_Len = StringLen(StringTrimLeft($RSSFile, $InfoSearchE))
$InfoSE = StringTrimRight($InfoSS, $InfoSE_Len)
_ArrayInsert($Info, $InfoNumA, $InfoSE)
WEnd
Return $Info
EndFunc
#endregion

$Link = "http://wcf.mscgva.ch/publicasmx/Tracking.asmx/GetRSSTrackingByContainerNumber?ContainerNumber=MSCU4727397"
$Test1 = _RSSGetInfo($Link, "<channel>", "</channel>", 1)
MsgBox(0, "Test", $Test1)









share|improve this question
























  • Does it return an error? Insert ConsoleWrite(StringFormat('line:%i error:%i ext:%in', @ScriptLineNumber, @error, @extended)) after function calls to find out if and from where.

    – user4157124
    Mar 6 at 12:20











  • user4157124, I added your statement after each function call. Nothing really happens. No error is outputted. I even ran it through command line: "C:Program Files (x86)AutoIt3AutoIt3.exe" msc777.au3 The page comes up, but no errors show.

    – Allied Stack
    Mar 6 at 14:37















1















I was able to read dynamic information from a website through the second link (commented out in the code below). If I uncomment the second line it works fine, and I get the information I want. If I use the first link it doesn't work; the file that gets generated is 0 bytes.



The first time you might have to press some button and run the script again (depends on browser). So how to get the desired result? I need the ETA, the one at the top: Arrival">ETA</a> : March 23, 2019 </td></tr> </table>.



_RSSGetInfo() didn't work either (the shipper indicates it is an XML RSS feed, but I don't know whether this is the right thing to use; it gave me a blank).



#include <MsgBoxConstants.au3>
#include <IE.au3>
#include <Array.au3>
#include <Date.au3>
#include <String.au3>
#include <Excel.au3>
#include <WinAPIFiles.au3>

$Link = "http://wcf.mscgva.ch/publicasmx/Tracking.asmx/GetRSSTrackingByContainerNumber?ContainerNumber=MSCU4727397"
;$Link = "https://www.hapag-lloyd.com/en/online-business/tracing/tracing-by-booking.html?blno=HLCUEUR1810BCLY1"

$file = fileopen(@ScriptDir & "XYZ.txt", 2 + 8)
$IE = _IECreate($Link, 0, 1, 1, 1)

Sleep(2000)
$source = _IEDocReadHTML($IE)
FileWrite($file, $source)

MsgBox(0, "Source", $source)


Here is the RSSInfo version, which gives me a blank (I found this on the internet, and edited it) :



#include <MsgBoxConstants.au3>
#include <IE.au3>
#include <Array.au3>
#include <Date.au3>
#include <String.au3>
#include <Excel.au3>
#include <WinAPIFiles.au3>

#include-once
#region _RSS
; RSS Reader
; Created By: Frostfel
#include <INet.au3>
#include <Array.au3>

; ============================================================================
; Function: _RSSGetInfo($RSS, $RSS_InfoS, $RSS_InfoE[, $RSS_Info_ = 1])
; Description: Gets RSS Info
; Parameter(s): $RSS = RSS Feed Example: "http://feed.com/index.xml"
; $RSS_InfoS = String to find for info start Example: <title>
; $RSS_InfoE = String to find for info end Example: </title>
; $RSS_Info_Start = [optional] <info>/</info> To start at
; Some RSS feeds will have page titles
; you dont want Defualt = 0
; Requirement(s): None
; Return Value(s): On Success - Returns RSS Info in Array Starting at 1
; On Failure - Returns 0
; @Error = 1 - Failed to get RSS Feed
; Author(s): Frostfel
; ============================================================================
Func _RSSGetInfo($RSS, $RSS_InfoS, $RSS_InfoE, $RSS_Info_Start = 0)
$RSSFile = _INetGetSource($RSS)
If @Error Then
SetError(1)
Return -1
EndIf
Dim $InfoSearchS = 1
Dim $Info[1000]
Dim $InfoNumA
$InfoNum = $RSS_Info_Start
While $InfoSearchS <> 6
$InfoNum += 1
$InfoNumA += 1
$InfoSearchS = StringInStr($RSSFile, $RSS_InfoS, 0, $InfoNum)
$InfoSearchE = StringInStr($RSSFile, $RSS_InfoE, 0, $InfoNum)
$InfoSearchS += 6
$InfoSS = StringTrimLeft($RSSFile, $InfoSearchS)
$InfoSearchE -= 1
$InfoSE_Len = StringLen(StringTrimLeft($RSSFile, $InfoSearchE))
$InfoSE = StringTrimRight($InfoSS, $InfoSE_Len)
_ArrayInsert($Info, $InfoNumA, $InfoSE)
WEnd
Return $Info
EndFunc
#endregion

$Link = "http://wcf.mscgva.ch/publicasmx/Tracking.asmx/GetRSSTrackingByContainerNumber?ContainerNumber=MSCU4727397"
$Test1 = _RSSGetInfo($Link, "<channel>", "</channel>", 1)
MsgBox(0, "Test", $Test1)









share|improve this question
























  • Does it return an error? Insert ConsoleWrite(StringFormat('line:%i error:%i ext:%in', @ScriptLineNumber, @error, @extended)) after function calls to find out if and from where.

    – user4157124
    Mar 6 at 12:20











  • user4157124, I added your statement after each function call. Nothing really happens. No error is outputted. I even ran it through command line: "C:Program Files (x86)AutoIt3AutoIt3.exe" msc777.au3 The page comes up, but no errors show.

    – Allied Stack
    Mar 6 at 14:37













1












1








1








I was able to read dynamic information from a website through the second link (commented out in the code below). If I uncomment the second line it works fine, and I get the information I want. If I use the first link it doesn't work; the file that gets generated is 0 bytes.



The first time you might have to press some button and run the script again (depends on browser). So how to get the desired result? I need the ETA, the one at the top: Arrival">ETA</a> : March 23, 2019 </td></tr> </table>.



_RSSGetInfo() didn't work either (the shipper indicates it is an XML RSS feed, but I don't know whether this is the right thing to use; it gave me a blank).



#include <MsgBoxConstants.au3>
#include <IE.au3>
#include <Array.au3>
#include <Date.au3>
#include <String.au3>
#include <Excel.au3>
#include <WinAPIFiles.au3>

$Link = "http://wcf.mscgva.ch/publicasmx/Tracking.asmx/GetRSSTrackingByContainerNumber?ContainerNumber=MSCU4727397"
;$Link = "https://www.hapag-lloyd.com/en/online-business/tracing/tracing-by-booking.html?blno=HLCUEUR1810BCLY1"

$file = fileopen(@ScriptDir & "XYZ.txt", 2 + 8)
$IE = _IECreate($Link, 0, 1, 1, 1)

Sleep(2000)
$source = _IEDocReadHTML($IE)
FileWrite($file, $source)

MsgBox(0, "Source", $source)


Here is the RSSInfo version, which gives me a blank (I found this on the internet, and edited it) :



#include <MsgBoxConstants.au3>
#include <IE.au3>
#include <Array.au3>
#include <Date.au3>
#include <String.au3>
#include <Excel.au3>
#include <WinAPIFiles.au3>

#include-once
#region _RSS
; RSS Reader
; Created By: Frostfel
#include <INet.au3>
#include <Array.au3>

; ============================================================================
; Function: _RSSGetInfo($RSS, $RSS_InfoS, $RSS_InfoE[, $RSS_Info_ = 1])
; Description: Gets RSS Info
; Parameter(s): $RSS = RSS Feed Example: "http://feed.com/index.xml"
; $RSS_InfoS = String to find for info start Example: <title>
; $RSS_InfoE = String to find for info end Example: </title>
; $RSS_Info_Start = [optional] <info>/</info> To start at
; Some RSS feeds will have page titles
; you dont want Defualt = 0
; Requirement(s): None
; Return Value(s): On Success - Returns RSS Info in Array Starting at 1
; On Failure - Returns 0
; @Error = 1 - Failed to get RSS Feed
; Author(s): Frostfel
; ============================================================================
Func _RSSGetInfo($RSS, $RSS_InfoS, $RSS_InfoE, $RSS_Info_Start = 0)
$RSSFile = _INetGetSource($RSS)
If @Error Then
SetError(1)
Return -1
EndIf
Dim $InfoSearchS = 1
Dim $Info[1000]
Dim $InfoNumA
$InfoNum = $RSS_Info_Start
While $InfoSearchS <> 6
$InfoNum += 1
$InfoNumA += 1
$InfoSearchS = StringInStr($RSSFile, $RSS_InfoS, 0, $InfoNum)
$InfoSearchE = StringInStr($RSSFile, $RSS_InfoE, 0, $InfoNum)
$InfoSearchS += 6
$InfoSS = StringTrimLeft($RSSFile, $InfoSearchS)
$InfoSearchE -= 1
$InfoSE_Len = StringLen(StringTrimLeft($RSSFile, $InfoSearchE))
$InfoSE = StringTrimRight($InfoSS, $InfoSE_Len)
_ArrayInsert($Info, $InfoNumA, $InfoSE)
WEnd
Return $Info
EndFunc
#endregion

$Link = "http://wcf.mscgva.ch/publicasmx/Tracking.asmx/GetRSSTrackingByContainerNumber?ContainerNumber=MSCU4727397"
$Test1 = _RSSGetInfo($Link, "<channel>", "</channel>", 1)
MsgBox(0, "Test", $Test1)









share|improve this question
















I was able to read dynamic information from a website through the second link (commented out in the code below). If I uncomment the second line it works fine, and I get the information I want. If I use the first link it doesn't work; the file that gets generated is 0 bytes.



The first time you might have to press some button and run the script again (depends on browser). So how to get the desired result? I need the ETA, the one at the top: Arrival">ETA</a> : March 23, 2019 </td></tr> </table>.



_RSSGetInfo() didn't work either (the shipper indicates it is an XML RSS feed, but I don't know whether this is the right thing to use; it gave me a blank).



#include <MsgBoxConstants.au3>
#include <IE.au3>
#include <Array.au3>
#include <Date.au3>
#include <String.au3>
#include <Excel.au3>
#include <WinAPIFiles.au3>

$Link = "http://wcf.mscgva.ch/publicasmx/Tracking.asmx/GetRSSTrackingByContainerNumber?ContainerNumber=MSCU4727397"
;$Link = "https://www.hapag-lloyd.com/en/online-business/tracing/tracing-by-booking.html?blno=HLCUEUR1810BCLY1"

$file = fileopen(@ScriptDir & "XYZ.txt", 2 + 8)
$IE = _IECreate($Link, 0, 1, 1, 1)

Sleep(2000)
$source = _IEDocReadHTML($IE)
FileWrite($file, $source)

MsgBox(0, "Source", $source)


Here is the RSSInfo version, which gives me a blank (I found this on the internet, and edited it) :



#include <MsgBoxConstants.au3>
#include <IE.au3>
#include <Array.au3>
#include <Date.au3>
#include <String.au3>
#include <Excel.au3>
#include <WinAPIFiles.au3>

#include-once
#region _RSS
; RSS Reader
; Created By: Frostfel
#include <INet.au3>
#include <Array.au3>

; ============================================================================
; Function: _RSSGetInfo($RSS, $RSS_InfoS, $RSS_InfoE[, $RSS_Info_ = 1])
; Description: Gets RSS Info
; Parameter(s): $RSS = RSS Feed Example: "http://feed.com/index.xml"
; $RSS_InfoS = String to find for info start Example: <title>
; $RSS_InfoE = String to find for info end Example: </title>
; $RSS_Info_Start = [optional] <info>/</info> To start at
; Some RSS feeds will have page titles
; you dont want Defualt = 0
; Requirement(s): None
; Return Value(s): On Success - Returns RSS Info in Array Starting at 1
; On Failure - Returns 0
; @Error = 1 - Failed to get RSS Feed
; Author(s): Frostfel
; ============================================================================
Func _RSSGetInfo($RSS, $RSS_InfoS, $RSS_InfoE, $RSS_Info_Start = 0)
$RSSFile = _INetGetSource($RSS)
If @Error Then
SetError(1)
Return -1
EndIf
Dim $InfoSearchS = 1
Dim $Info[1000]
Dim $InfoNumA
$InfoNum = $RSS_Info_Start
While $InfoSearchS <> 6
$InfoNum += 1
$InfoNumA += 1
$InfoSearchS = StringInStr($RSSFile, $RSS_InfoS, 0, $InfoNum)
$InfoSearchE = StringInStr($RSSFile, $RSS_InfoE, 0, $InfoNum)
$InfoSearchS += 6
$InfoSS = StringTrimLeft($RSSFile, $InfoSearchS)
$InfoSearchE -= 1
$InfoSE_Len = StringLen(StringTrimLeft($RSSFile, $InfoSearchE))
$InfoSE = StringTrimRight($InfoSS, $InfoSE_Len)
_ArrayInsert($Info, $InfoNumA, $InfoSE)
WEnd
Return $Info
EndFunc
#endregion

$Link = "http://wcf.mscgva.ch/publicasmx/Tracking.asmx/GetRSSTrackingByContainerNumber?ContainerNumber=MSCU4727397"
$Test1 = _RSSGetInfo($Link, "<channel>", "</channel>", 1)
MsgBox(0, "Test", $Test1)






xml rss autoit






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 7 at 13:25









user4157124

2,23451333




2,23451333










asked Mar 4 at 22:02









Allied StackAllied Stack

236




236












  • Does it return an error? Insert ConsoleWrite(StringFormat('line:%i error:%i ext:%in', @ScriptLineNumber, @error, @extended)) after function calls to find out if and from where.

    – user4157124
    Mar 6 at 12:20











  • user4157124, I added your statement after each function call. Nothing really happens. No error is outputted. I even ran it through command line: "C:Program Files (x86)AutoIt3AutoIt3.exe" msc777.au3 The page comes up, but no errors show.

    – Allied Stack
    Mar 6 at 14:37

















  • Does it return an error? Insert ConsoleWrite(StringFormat('line:%i error:%i ext:%in', @ScriptLineNumber, @error, @extended)) after function calls to find out if and from where.

    – user4157124
    Mar 6 at 12:20











  • user4157124, I added your statement after each function call. Nothing really happens. No error is outputted. I even ran it through command line: "C:Program Files (x86)AutoIt3AutoIt3.exe" msc777.au3 The page comes up, but no errors show.

    – Allied Stack
    Mar 6 at 14:37
















Does it return an error? Insert ConsoleWrite(StringFormat('line:%i error:%i ext:%in', @ScriptLineNumber, @error, @extended)) after function calls to find out if and from where.

– user4157124
Mar 6 at 12:20





Does it return an error? Insert ConsoleWrite(StringFormat('line:%i error:%i ext:%in', @ScriptLineNumber, @error, @extended)) after function calls to find out if and from where.

– user4157124
Mar 6 at 12:20













user4157124, I added your statement after each function call. Nothing really happens. No error is outputted. I even ran it through command line: "C:Program Files (x86)AutoIt3AutoIt3.exe" msc777.au3 The page comes up, but no errors show.

– Allied Stack
Mar 6 at 14:37





user4157124, I added your statement after each function call. Nothing really happens. No error is outputted. I even ran it through command line: "C:Program Files (x86)AutoIt3AutoIt3.exe" msc777.au3 The page comes up, but no errors show.

– Allied Stack
Mar 6 at 14:37












2 Answers
2






active

oldest

votes


















1














; Url to get the source from.
$sUrl = 'http://wcf.mscgva.ch/publicasmx/Tracking.asmx/GetRSSTrackingByContainerNumber?ContainerNumber=MSCU4727397'

; Read source from the url.
$sSource = InetRead($sUrl)

; Convert source to utf-8 string (8 = utf-8).
$sSource = BinaryToString($sSource, 8)

; Get the eta dates (3 = return array of global matches).
$aETA = StringRegExp($sSource, '(?is)title="Estimated Time of Arrival"&gt;ETA&lt;/a&gt;s*:s*(.*?)s*&lt;', 3)

; Display the eta date.
If UBound($aETA) Then
MsgBox(0, @ScriptName, $aETA[0])
EndIf


This gets the ETA date from the HTML within the RSS/XML source usings regular expressions.



StringRegExp options (?is) are i for insenstive and s for single line.
Some spaces may exist around the date value, s* is used to match them.
The : is part of the date value and is matched.
This allows (.*?) group to get just the ETA date.



$aETA contains all ETA dates in an array, though the 1st is $aETA[0]
which is shown in the Msgbox, This is the ETA date you mentioned
is the one at the top in a comment.






share|improve this answer






























    1














    Example listing <description> -tags (using XML.au3), extracting from contained HTML (using IE.au3) :



    #include <Array.au3>
    #include <IE.au3>
    #include "XML.au3"

    Global Const $g_iElement = 1, _; n-th XML <description> -tag.
    $g_iColCont = 3, _; n-th XML property column (tag content).
    $g_iTblCol = 4, _; n-th HTML table col ("Final Discharge Port").
    $g_iTblRow = 2; n-th HTML table row (column's content).
    Global Const $g_sFileTmp = @ScriptDir & 'rss_extract.html', _
    $g_sTplHtml = '<html>n<head>n<title>%s</title>n</head>n<body>n%sn</body>n</html>n', _
    $g_sRssUrl = 'http://wcf.mscgva.ch/publicasmx/Tracking.asmx/GetRSSTrackingByContainerNumber?ContainerNumber=MSCU4727397', _
    $g_sRssXpt = '//channel/item/description'

    Global $g_sRssTxt = InetRead($g_sRssUrl)
    Global $g_aXmlNode, $g_aTable
    Global $g_oXmlDoc, $g_oXmlNode, $g_oIE, $g_oTable

    $g_sRssTxt = BinaryToString($g_sRssTxt)
    $g_oXmlDoc = _XML_CreateDOMDocument()
    $g_oXmlDoc = _XML_LoadXML($g_oXmlDoc, $g_sRssTxt)
    $g_oXmlNode = _XML_SelectNodes($g_oXmlDoc, $g_sRssXpt)
    $g_aXmlNode = _XML_Array_GetNodesProperties($g_oXmlNode)

    _ArrayDisplay($g_aXmlNode)
    FileWrite($g_sFileTmp, StringFormat($g_sTplHtml, $g_sFileTmp, $g_aXmlNode[$g_iElement][$g_iColCont]))

    $g_oIE = _IECreate($g_sFileTmp)
    $g_oTable = _IETableGetCollection($g_oIE, 1)
    $g_aTable = _IETableWriteToArray($g_oTable)

    _ArrayDisplay($g_aTable)
    MsgBox(Default, @ScriptName, $g_aTable[0][$g_iTblCol] & ' =' & @CRLF & @CRLF & $g_aTable[$g_iTblRow][$g_iTblCol])
    _IEQuit($g_oIE)
    FileDelete($g_sFileTmp)


    $g_aTable[$g_iTblRow][$g_iTblCol] contains HOUSTON US ETA : March 23, 2019 .






    share|improve this answer

























    • I even tried running through command prompt.... nothing seems to happen. "C:Program Files (x86)AutoIt3AutoIt3.exe" MSC777.AU3 See related comment above.

      – Allied Stack
      Mar 6 at 18:10











    • @AlliedStack Added response received (look at console). 2nd example handles HTML in XML.

      – user4157124
      Mar 7 at 12:47










    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54992246%2freading-web-content-may-be-rss%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    ; Url to get the source from.
    $sUrl = 'http://wcf.mscgva.ch/publicasmx/Tracking.asmx/GetRSSTrackingByContainerNumber?ContainerNumber=MSCU4727397'

    ; Read source from the url.
    $sSource = InetRead($sUrl)

    ; Convert source to utf-8 string (8 = utf-8).
    $sSource = BinaryToString($sSource, 8)

    ; Get the eta dates (3 = return array of global matches).
    $aETA = StringRegExp($sSource, '(?is)title="Estimated Time of Arrival"&gt;ETA&lt;/a&gt;s*:s*(.*?)s*&lt;', 3)

    ; Display the eta date.
    If UBound($aETA) Then
    MsgBox(0, @ScriptName, $aETA[0])
    EndIf


    This gets the ETA date from the HTML within the RSS/XML source usings regular expressions.



    StringRegExp options (?is) are i for insenstive and s for single line.
    Some spaces may exist around the date value, s* is used to match them.
    The : is part of the date value and is matched.
    This allows (.*?) group to get just the ETA date.



    $aETA contains all ETA dates in an array, though the 1st is $aETA[0]
    which is shown in the Msgbox, This is the ETA date you mentioned
    is the one at the top in a comment.






    share|improve this answer



























      1














      ; Url to get the source from.
      $sUrl = 'http://wcf.mscgva.ch/publicasmx/Tracking.asmx/GetRSSTrackingByContainerNumber?ContainerNumber=MSCU4727397'

      ; Read source from the url.
      $sSource = InetRead($sUrl)

      ; Convert source to utf-8 string (8 = utf-8).
      $sSource = BinaryToString($sSource, 8)

      ; Get the eta dates (3 = return array of global matches).
      $aETA = StringRegExp($sSource, '(?is)title="Estimated Time of Arrival"&gt;ETA&lt;/a&gt;s*:s*(.*?)s*&lt;', 3)

      ; Display the eta date.
      If UBound($aETA) Then
      MsgBox(0, @ScriptName, $aETA[0])
      EndIf


      This gets the ETA date from the HTML within the RSS/XML source usings regular expressions.



      StringRegExp options (?is) are i for insenstive and s for single line.
      Some spaces may exist around the date value, s* is used to match them.
      The : is part of the date value and is matched.
      This allows (.*?) group to get just the ETA date.



      $aETA contains all ETA dates in an array, though the 1st is $aETA[0]
      which is shown in the Msgbox, This is the ETA date you mentioned
      is the one at the top in a comment.






      share|improve this answer

























        1












        1








        1







        ; Url to get the source from.
        $sUrl = 'http://wcf.mscgva.ch/publicasmx/Tracking.asmx/GetRSSTrackingByContainerNumber?ContainerNumber=MSCU4727397'

        ; Read source from the url.
        $sSource = InetRead($sUrl)

        ; Convert source to utf-8 string (8 = utf-8).
        $sSource = BinaryToString($sSource, 8)

        ; Get the eta dates (3 = return array of global matches).
        $aETA = StringRegExp($sSource, '(?is)title="Estimated Time of Arrival"&gt;ETA&lt;/a&gt;s*:s*(.*?)s*&lt;', 3)

        ; Display the eta date.
        If UBound($aETA) Then
        MsgBox(0, @ScriptName, $aETA[0])
        EndIf


        This gets the ETA date from the HTML within the RSS/XML source usings regular expressions.



        StringRegExp options (?is) are i for insenstive and s for single line.
        Some spaces may exist around the date value, s* is used to match them.
        The : is part of the date value and is matched.
        This allows (.*?) group to get just the ETA date.



        $aETA contains all ETA dates in an array, though the 1st is $aETA[0]
        which is shown in the Msgbox, This is the ETA date you mentioned
        is the one at the top in a comment.






        share|improve this answer













        ; Url to get the source from.
        $sUrl = 'http://wcf.mscgva.ch/publicasmx/Tracking.asmx/GetRSSTrackingByContainerNumber?ContainerNumber=MSCU4727397'

        ; Read source from the url.
        $sSource = InetRead($sUrl)

        ; Convert source to utf-8 string (8 = utf-8).
        $sSource = BinaryToString($sSource, 8)

        ; Get the eta dates (3 = return array of global matches).
        $aETA = StringRegExp($sSource, '(?is)title="Estimated Time of Arrival"&gt;ETA&lt;/a&gt;s*:s*(.*?)s*&lt;', 3)

        ; Display the eta date.
        If UBound($aETA) Then
        MsgBox(0, @ScriptName, $aETA[0])
        EndIf


        This gets the ETA date from the HTML within the RSS/XML source usings regular expressions.



        StringRegExp options (?is) are i for insenstive and s for single line.
        Some spaces may exist around the date value, s* is used to match them.
        The : is part of the date value and is matched.
        This allows (.*?) group to get just the ETA date.



        $aETA contains all ETA dates in an array, though the 1st is $aETA[0]
        which is shown in the Msgbox, This is the ETA date you mentioned
        is the one at the top in a comment.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 7 at 4:39









        michael_heathmichael_heath

        2,8972618




        2,8972618























            1














            Example listing <description> -tags (using XML.au3), extracting from contained HTML (using IE.au3) :



            #include <Array.au3>
            #include <IE.au3>
            #include "XML.au3"

            Global Const $g_iElement = 1, _; n-th XML <description> -tag.
            $g_iColCont = 3, _; n-th XML property column (tag content).
            $g_iTblCol = 4, _; n-th HTML table col ("Final Discharge Port").
            $g_iTblRow = 2; n-th HTML table row (column's content).
            Global Const $g_sFileTmp = @ScriptDir & 'rss_extract.html', _
            $g_sTplHtml = '<html>n<head>n<title>%s</title>n</head>n<body>n%sn</body>n</html>n', _
            $g_sRssUrl = 'http://wcf.mscgva.ch/publicasmx/Tracking.asmx/GetRSSTrackingByContainerNumber?ContainerNumber=MSCU4727397', _
            $g_sRssXpt = '//channel/item/description'

            Global $g_sRssTxt = InetRead($g_sRssUrl)
            Global $g_aXmlNode, $g_aTable
            Global $g_oXmlDoc, $g_oXmlNode, $g_oIE, $g_oTable

            $g_sRssTxt = BinaryToString($g_sRssTxt)
            $g_oXmlDoc = _XML_CreateDOMDocument()
            $g_oXmlDoc = _XML_LoadXML($g_oXmlDoc, $g_sRssTxt)
            $g_oXmlNode = _XML_SelectNodes($g_oXmlDoc, $g_sRssXpt)
            $g_aXmlNode = _XML_Array_GetNodesProperties($g_oXmlNode)

            _ArrayDisplay($g_aXmlNode)
            FileWrite($g_sFileTmp, StringFormat($g_sTplHtml, $g_sFileTmp, $g_aXmlNode[$g_iElement][$g_iColCont]))

            $g_oIE = _IECreate($g_sFileTmp)
            $g_oTable = _IETableGetCollection($g_oIE, 1)
            $g_aTable = _IETableWriteToArray($g_oTable)

            _ArrayDisplay($g_aTable)
            MsgBox(Default, @ScriptName, $g_aTable[0][$g_iTblCol] & ' =' & @CRLF & @CRLF & $g_aTable[$g_iTblRow][$g_iTblCol])
            _IEQuit($g_oIE)
            FileDelete($g_sFileTmp)


            $g_aTable[$g_iTblRow][$g_iTblCol] contains HOUSTON US ETA : March 23, 2019 .






            share|improve this answer

























            • I even tried running through command prompt.... nothing seems to happen. "C:Program Files (x86)AutoIt3AutoIt3.exe" MSC777.AU3 See related comment above.

              – Allied Stack
              Mar 6 at 18:10











            • @AlliedStack Added response received (look at console). 2nd example handles HTML in XML.

              – user4157124
              Mar 7 at 12:47















            1














            Example listing <description> -tags (using XML.au3), extracting from contained HTML (using IE.au3) :



            #include <Array.au3>
            #include <IE.au3>
            #include "XML.au3"

            Global Const $g_iElement = 1, _; n-th XML <description> -tag.
            $g_iColCont = 3, _; n-th XML property column (tag content).
            $g_iTblCol = 4, _; n-th HTML table col ("Final Discharge Port").
            $g_iTblRow = 2; n-th HTML table row (column's content).
            Global Const $g_sFileTmp = @ScriptDir & 'rss_extract.html', _
            $g_sTplHtml = '<html>n<head>n<title>%s</title>n</head>n<body>n%sn</body>n</html>n', _
            $g_sRssUrl = 'http://wcf.mscgva.ch/publicasmx/Tracking.asmx/GetRSSTrackingByContainerNumber?ContainerNumber=MSCU4727397', _
            $g_sRssXpt = '//channel/item/description'

            Global $g_sRssTxt = InetRead($g_sRssUrl)
            Global $g_aXmlNode, $g_aTable
            Global $g_oXmlDoc, $g_oXmlNode, $g_oIE, $g_oTable

            $g_sRssTxt = BinaryToString($g_sRssTxt)
            $g_oXmlDoc = _XML_CreateDOMDocument()
            $g_oXmlDoc = _XML_LoadXML($g_oXmlDoc, $g_sRssTxt)
            $g_oXmlNode = _XML_SelectNodes($g_oXmlDoc, $g_sRssXpt)
            $g_aXmlNode = _XML_Array_GetNodesProperties($g_oXmlNode)

            _ArrayDisplay($g_aXmlNode)
            FileWrite($g_sFileTmp, StringFormat($g_sTplHtml, $g_sFileTmp, $g_aXmlNode[$g_iElement][$g_iColCont]))

            $g_oIE = _IECreate($g_sFileTmp)
            $g_oTable = _IETableGetCollection($g_oIE, 1)
            $g_aTable = _IETableWriteToArray($g_oTable)

            _ArrayDisplay($g_aTable)
            MsgBox(Default, @ScriptName, $g_aTable[0][$g_iTblCol] & ' =' & @CRLF & @CRLF & $g_aTable[$g_iTblRow][$g_iTblCol])
            _IEQuit($g_oIE)
            FileDelete($g_sFileTmp)


            $g_aTable[$g_iTblRow][$g_iTblCol] contains HOUSTON US ETA : March 23, 2019 .






            share|improve this answer

























            • I even tried running through command prompt.... nothing seems to happen. "C:Program Files (x86)AutoIt3AutoIt3.exe" MSC777.AU3 See related comment above.

              – Allied Stack
              Mar 6 at 18:10











            • @AlliedStack Added response received (look at console). 2nd example handles HTML in XML.

              – user4157124
              Mar 7 at 12:47













            1












            1








            1







            Example listing <description> -tags (using XML.au3), extracting from contained HTML (using IE.au3) :



            #include <Array.au3>
            #include <IE.au3>
            #include "XML.au3"

            Global Const $g_iElement = 1, _; n-th XML <description> -tag.
            $g_iColCont = 3, _; n-th XML property column (tag content).
            $g_iTblCol = 4, _; n-th HTML table col ("Final Discharge Port").
            $g_iTblRow = 2; n-th HTML table row (column's content).
            Global Const $g_sFileTmp = @ScriptDir & 'rss_extract.html', _
            $g_sTplHtml = '<html>n<head>n<title>%s</title>n</head>n<body>n%sn</body>n</html>n', _
            $g_sRssUrl = 'http://wcf.mscgva.ch/publicasmx/Tracking.asmx/GetRSSTrackingByContainerNumber?ContainerNumber=MSCU4727397', _
            $g_sRssXpt = '//channel/item/description'

            Global $g_sRssTxt = InetRead($g_sRssUrl)
            Global $g_aXmlNode, $g_aTable
            Global $g_oXmlDoc, $g_oXmlNode, $g_oIE, $g_oTable

            $g_sRssTxt = BinaryToString($g_sRssTxt)
            $g_oXmlDoc = _XML_CreateDOMDocument()
            $g_oXmlDoc = _XML_LoadXML($g_oXmlDoc, $g_sRssTxt)
            $g_oXmlNode = _XML_SelectNodes($g_oXmlDoc, $g_sRssXpt)
            $g_aXmlNode = _XML_Array_GetNodesProperties($g_oXmlNode)

            _ArrayDisplay($g_aXmlNode)
            FileWrite($g_sFileTmp, StringFormat($g_sTplHtml, $g_sFileTmp, $g_aXmlNode[$g_iElement][$g_iColCont]))

            $g_oIE = _IECreate($g_sFileTmp)
            $g_oTable = _IETableGetCollection($g_oIE, 1)
            $g_aTable = _IETableWriteToArray($g_oTable)

            _ArrayDisplay($g_aTable)
            MsgBox(Default, @ScriptName, $g_aTable[0][$g_iTblCol] & ' =' & @CRLF & @CRLF & $g_aTable[$g_iTblRow][$g_iTblCol])
            _IEQuit($g_oIE)
            FileDelete($g_sFileTmp)


            $g_aTable[$g_iTblRow][$g_iTblCol] contains HOUSTON US ETA : March 23, 2019 .






            share|improve this answer















            Example listing <description> -tags (using XML.au3), extracting from contained HTML (using IE.au3) :



            #include <Array.au3>
            #include <IE.au3>
            #include "XML.au3"

            Global Const $g_iElement = 1, _; n-th XML <description> -tag.
            $g_iColCont = 3, _; n-th XML property column (tag content).
            $g_iTblCol = 4, _; n-th HTML table col ("Final Discharge Port").
            $g_iTblRow = 2; n-th HTML table row (column's content).
            Global Const $g_sFileTmp = @ScriptDir & 'rss_extract.html', _
            $g_sTplHtml = '<html>n<head>n<title>%s</title>n</head>n<body>n%sn</body>n</html>n', _
            $g_sRssUrl = 'http://wcf.mscgva.ch/publicasmx/Tracking.asmx/GetRSSTrackingByContainerNumber?ContainerNumber=MSCU4727397', _
            $g_sRssXpt = '//channel/item/description'

            Global $g_sRssTxt = InetRead($g_sRssUrl)
            Global $g_aXmlNode, $g_aTable
            Global $g_oXmlDoc, $g_oXmlNode, $g_oIE, $g_oTable

            $g_sRssTxt = BinaryToString($g_sRssTxt)
            $g_oXmlDoc = _XML_CreateDOMDocument()
            $g_oXmlDoc = _XML_LoadXML($g_oXmlDoc, $g_sRssTxt)
            $g_oXmlNode = _XML_SelectNodes($g_oXmlDoc, $g_sRssXpt)
            $g_aXmlNode = _XML_Array_GetNodesProperties($g_oXmlNode)

            _ArrayDisplay($g_aXmlNode)
            FileWrite($g_sFileTmp, StringFormat($g_sTplHtml, $g_sFileTmp, $g_aXmlNode[$g_iElement][$g_iColCont]))

            $g_oIE = _IECreate($g_sFileTmp)
            $g_oTable = _IETableGetCollection($g_oIE, 1)
            $g_aTable = _IETableWriteToArray($g_oTable)

            _ArrayDisplay($g_aTable)
            MsgBox(Default, @ScriptName, $g_aTable[0][$g_iTblCol] & ' =' & @CRLF & @CRLF & $g_aTable[$g_iTblRow][$g_iTblCol])
            _IEQuit($g_oIE)
            FileDelete($g_sFileTmp)


            $g_aTable[$g_iTblRow][$g_iTblCol] contains HOUSTON US ETA : March 23, 2019 .







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 8 at 0:32

























            answered Mar 6 at 15:31









            user4157124user4157124

            2,23451333




            2,23451333












            • I even tried running through command prompt.... nothing seems to happen. "C:Program Files (x86)AutoIt3AutoIt3.exe" MSC777.AU3 See related comment above.

              – Allied Stack
              Mar 6 at 18:10











            • @AlliedStack Added response received (look at console). 2nd example handles HTML in XML.

              – user4157124
              Mar 7 at 12:47

















            • I even tried running through command prompt.... nothing seems to happen. "C:Program Files (x86)AutoIt3AutoIt3.exe" MSC777.AU3 See related comment above.

              – Allied Stack
              Mar 6 at 18:10











            • @AlliedStack Added response received (look at console). 2nd example handles HTML in XML.

              – user4157124
              Mar 7 at 12:47
















            I even tried running through command prompt.... nothing seems to happen. "C:Program Files (x86)AutoIt3AutoIt3.exe" MSC777.AU3 See related comment above.

            – Allied Stack
            Mar 6 at 18:10





            I even tried running through command prompt.... nothing seems to happen. "C:Program Files (x86)AutoIt3AutoIt3.exe" MSC777.AU3 See related comment above.

            – Allied Stack
            Mar 6 at 18:10













            @AlliedStack Added response received (look at console). 2nd example handles HTML in XML.

            – user4157124
            Mar 7 at 12:47





            @AlliedStack Added response received (look at console). 2nd example handles HTML in XML.

            – user4157124
            Mar 7 at 12:47

















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54992246%2freading-web-content-may-be-rss%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to get text form Clipboard with JavaScript in Firefox 56?How to validate an email address in JavaScript?How do JavaScript closures work?How do I remove a property from a JavaScript object?How do you get a timestamp in JavaScript?How do I copy to the clipboard in JavaScript?How do I include a JavaScript file in another JavaScript file?Get the current URL with JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?

            Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

            List of MPs elected to the English parliament in 1640 (April) Contents List of constituencies and members See also Notes References Navigation menueNational Archives – The Glynde Place ArchivesCobbett's Parliamentary history of England, from the Norman Conquest in 1066 to the year 1803'Aldermen in Parliament', The Aldermen of the City of London: Temp. Henry III – 1912onepage&q&f&#61, false 229