Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > microsoft.public.excel.programming > #109221
| From | Robert Baer <robertbaer@localnet.com> |
|---|---|
| Newsgroups | microsoft.public.excel.programming, microsoft.public.excel |
| Subject | Re: Read (and parse) file on the web |
| References | <3TQvz.6110$BN1.1595@fx02.iad> <XnsA67055067A5A6auricauricauricauric@213.239.209.88> |
| Message-ID | <6bwwz.1429$EP2.1313@fx12.iad> (permalink) |
| Date | 2016-08-27 23:14 -0800 |
Cross-posted to 2 groups.
Auric__ wrote:
> Robert Baer wrote:
>
>> Excel macros are SO... undocumented.
>
> Sure they are. Plenty of documentation for individual keywords. You're not
> looking for that, you're looking for a broader concept than individual
> keywords.
>
>> Need a WORKING example for reading the HTML source a URL (say
>> http://www.oil4lessllc.org/gTX.htm)
>
> Downloading a web page (or any URI, really) is easy:
>
> Declare Function URLDownloadToFile Lib "urlmon" _
> Alias "URLDownloadToFileA" (ByVal pCaller As Long, _
> ByVal szURL As String, ByVal szFileName As String, _
> ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
>
> Sub foo()
> Dim tmp, result, contents
> tmp = Environ("TEMP")& Format$(Now, "yyyymmdd-hhmmss-")& "gTX.htm"
> 'download
> result = URLDownloadToFile(0, "http://www.oil4lessllc.org/gTX.htm", _
> tmp, 0, 0)
> If result<> 0 Then
> 'failed to download; error handler here
> Else
> 'read from file
> Open tmp For Binary As 1
> contents = Space$(LOF(1))
> Get #1, 1, contents
> Close 1
> 'parse file here
> '[...]
> 'cleanup
> End If
> Kill tmp
> End Sub
>
> (Note that URLDownloadToFile must be declared PtrSafe on 64-bit versions of
> Excel.)
>
> Dealing with the data downloaded is very dependant on what the page contains
> and what you want to extract from it. That page you mentioned contains 2
> images and 2 Javascript arrays; assuming you want the data from the arrays,
> you could search for "awls[" or "aprd[" and get your data that way.
>
> Rather than downloading to a file, it is possible to download straight to
> memory, but I find it's simpler to use a temp file. Among other things,
> downloading to memory requires opening and closing the connection yourself;
> URLDownloadToFile handles that for you.
>
Well, i am in a pickle.
Firstly, i did a bit of experimenting, and i discovers a few things.
1) The variable "tmp" is nice, but does not have to have the date and
time; that would fill the HD since i have thousands of files to process.
Fix is easy - just have a constant name for use.
2) The file "tmp" is created ONLY if the value of "result" is zero.
3) The problem i have seems to be due to the fact that the online files
have no filetype:
"https://www.nsncenter.com/NSNSearch?q=5960%20regulator&PageNumber=5"
And i need to process page numbers from 5 to 999 (the reason for the
program).
I have processed page numbers from 1 to 4 by hand...PITA.
Ideas for a fix?
Thanks.
Back to microsoft.public.excel.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-08-26 10:57 -0800
Re: Read (and parse) file on the web "Auric__" <not.my.real@email.address> - 2016-08-26 15:21 +0000
Re: Read (and parse) file on the web "Auric__" <not.my.real@email.address> - 2016-08-26 15:22 +0000
Re: Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-08-27 13:04 -0800
Re: Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-08-27 13:00 -0800
Re: Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-08-27 23:14 -0800
Re: Read (and parse) file on the web CORRECTION Robert Baer <robertbaer@localnet.com> - 2016-08-28 09:42 -0800
Re: Read (and parse) file on the web CORRECTION#2 Robert Baer <robertbaer@localnet.com> - 2016-08-28 10:08 -0800
Re: Read (and parse) file on the web CORRECTION#2 "Auric__" <not.my.real@email.address> - 2016-08-29 01:51 +0000
Re: Read (and parse) file on the web CORRECTION#2 Robert Baer <robertbaer@localnet.com> - 2016-08-28 21:32 -0800
Re: Read (and parse) file on the web CORRECTION#2 "Auric__" <not.my.real@email.address> - 2016-08-29 19:41 +0000
Re: Read (and parse) file on the web CORRECTION#2 Robert Baer <robertbaer@localnet.com> - 2016-08-30 00:21 -0800
Re: Read (and parse) file on the web CORRECTION#2 GS <gs@v.invalid> - 2016-08-30 06:06 -0400
Re: Read (and parse) file on the web CORRECTION#2 Robert Baer <robertbaer@localnet.com> - 2016-08-30 14:20 -0800
Re: Read (and parse) file on the web CORRECTION#2 GS <gs@v.invalid> - 2016-08-30 18:43 -0400
Re: Read (and parse) file on the web CORRECTION#2 GS <gs@v.invalid> - 2016-08-31 16:47 -0400
Re: Read (and parse) file on the web CORRECTION#2 Robert Baer <robertbaer@localnet.com> - 2016-09-01 04:37 -0800
Re: Read (and parse) file on the web CORRECTION#2 GS <gs@v.invalid> - 2016-09-01 13:13 -0400
Re: Read (and parse) file on the web CORRECTION#2 Robert Baer <robertbaer@localnet.com> - 2016-09-01 16:32 -0800
Re: Read (and parse) file on the web CORRECTION#2 GS <gs@v.invalid> - 2016-09-01 19:43 -0400
Re: Read (and parse) file on the web CORRECTION#2 Robert Baer <robertbaer@localnet.com> - 2016-09-01 04:23 -0800
Re: Read (and parse) file on the web CORRECTION#2 GS <gs@v.invalid> - 2016-09-05 10:10 -0400
Re: Read (and parse) file on the web CORRECTION#2 GS <gs@v.invalid> - 2016-09-05 10:17 -0400
Re: Read (and parse) file on the web CORRECTION#3 Robert Baer <robertbaer@localnet.com> - 2016-09-05 20:50 -0800
Re: Read (and parse) file on the web CORRECTION#2 Robert Baer <robertbaer@localnet.com> - 2016-09-05 20:32 -0800
Re: Read (and parse) file on the web CORRECTION#2 GS <gs@v.invalid> - 2016-09-06 10:49 -0400
Re: Read (and parse) file on the web CORRECTION#2 Robert Baer <robertbaer@localnet.com> - 2016-09-06 12:05 -0800
Re: Read (and parse) file on the web CORRECTION#2 GS <gs@v.invalid> - 2016-09-06 15:15 -0400
Re: Read (and parse) file on the web CORRECTION#2 Robert Baer <robertbaer@localnet.com> - 2016-09-06 22:32 -0800
Re: Read (and parse) file on the web CORRECTION#2 GS <gs@v.invalid> - 2016-09-07 11:44 -0400
Re: Read (and parse) file on the web CORRECTION#2 Robert Baer <robertbaer@localnet.com> - 2016-09-07 09:33 -0800
Re: Read (and parse) file on the web CORRECTION#2 Robert Baer <robertbaer@localnet.com> - 2016-09-08 20:18 -0800
Re: Read (and parse) file on the web CORRECTION#2 GS <gs@v.invalid> - 2016-09-09 06:07 -0400
Re: Read (and parse) file on the web CORRECTION#2 GS <gs@v.invalid> - 2016-09-09 22:05 -0400
Re: Read (and parse) file on the web CORRECTION#2 Robert Baer <robertbaer@localnet.com> - 2016-09-14 17:16 -0800
Re: Read (and parse) file on the web CORRECTION#2 GS <gs@v.invalid> - 2016-09-14 20:23 -0400
Re: Read (and parse) file on the web CORRECTION#2 "Auric__" <not.my.real@email.address> - 2016-09-07 02:37 +0000
Re: Read (and parse) file on the web CORRECTION#2 Robert Baer <robertbaer@localnet.com> - 2016-09-06 22:43 -0800
Re: Read (and parse) file on the web CORRECTION#2 "Auric__" <not.my.real@email.address> - 2016-09-08 05:49 +0000
Re: Read (and parse) file on the web CORRECTION#2 Robert Baer <robertbaer@localnet.com> - 2016-09-08 01:07 -0800
Re: Read (and parse) file on the web CORRECTION#2 "Auric__" <not.my.real@email.address> - 2016-09-09 06:40 +0000
Re: Read (and parse) file on the web WGET versions Robert Baer <robertbaer@localnet.com> - 2016-09-08 01:19 -0800
Re: Read (and parse) file on the web WGET versions Robert Baer <robertbaer@localnet.com> - 2016-09-08 20:09 -0800
Re: Read (and parse) file on the web CORRECTION#2 Robert Baer <robertbaer@localnet.com> - 2016-09-06 23:49 -0800
Re: Read (and parse) file on the web GS <gs@v.invalid> - 2016-08-28 15:51 -0400
Re: Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-08-28 21:37 -0800
Re: Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-09-02 19:09 -0800
Re: Read (and parse) file on the web GS <gs@v.invalid> - 2016-08-29 01:56 -0400
Re: Read (and parse) file on the web GS <gs@v.invalid> - 2016-08-29 02:21 -0400
Re: Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-08-29 19:55 -0800
Re: Read (and parse) file on the web GS <gs@v.invalid> - 2016-08-29 23:35 -0400
Re: Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-08-29 22:25 -0800
Re: Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-08-29 19:21 -0800
Re: Read (and parse) file on the web GS <gs@v.invalid> - 2016-08-29 23:21 -0400
Re: Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-08-29 22:10 -0800
Re: Read (and parse) file on the web GS <gs@v.invalid> - 2016-08-30 04:04 -0400
Re: Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-08-30 13:48 -0800
Re: Read (and parse) file on the web GS <gs@v.invalid> - 2016-08-29 23:37 -0400
Re: Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-08-29 22:25 -0800
Re: Read (and parse) file on the web lovexes17816 <lovexes17816@gmail.com> - 2016-08-28 14:00 +0100
Re: Read (and parse) file on the web lovexes17816 <lovexes17816@gmail.com> - 2016-08-29 02:17 +0100
Re: Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-09-02 19:11 -0800
Re: Read (and parse) file on the web "Auric__" <not.my.real@email.address> - 2016-09-03 04:12 +0000
Re: Read (and parse) file on the web Tikivn23143 <Tikivn23143@gmail.com> - 2016-08-30 02:28 +0100
Re: Read (and parse) file on the web everonvietnam2016 <everonvietnam2016@gmail.com> - 2016-09-07 15:03 +0100
Re: Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-09-07 08:43 -0800
Re: Read (and parse) file on the web "Auric__" <not.my.real@email.address> - 2016-09-08 05:43 +0000
Re: Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-09-08 01:09 -0800
Re: Read (and parse) file on the web "Auric__" <not.my.real@email.address> - 2016-09-09 06:49 +0000
Re: Read (and parse) file on the web everonvietnam2016 <everonvietnam2016@gmail.com> - 2016-09-08 11:11 +0100
Re: Read (and parse) file on the web GS <gs@v.invalid> - 2016-09-14 17:14 -0400
Re: Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-09-14 17:19 -0800
Re: Read (and parse) file on the web GS <gs@v.invalid> - 2016-09-14 20:26 -0400
Re: Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-09-15 09:59 -0800
Re: Read (and parse) file on the web GS <gs@v.invalid> - 2016-09-15 14:33 -0400
Re: Read (and parse) file on the web GS <gs@v.invalid> - 2016-09-14 21:28 -0400
Re: Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-09-15 10:05 -0800
Re: Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-09-14 18:48 -0800
Re: Read (and parse) file on the web GS <gs@v.invalid> - 2016-09-14 21:59 -0400
Re: Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-09-15 10:15 -0800
Re: Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-09-15 22:10 -0800
Re: Read (and parse) file on the web GS <gs@v.invalid> - 2016-09-16 11:50 -0400
Re: Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-09-16 23:54 -0800
Re: Read (and parse) file on the web GS <gs@v.invalid> - 2016-09-17 11:06 -0400
Re: Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-09-17 23:59 -0800
Re: Read (and parse) file on the web GS <gs@v.invalid> - 2016-09-18 03:22 -0400
Re: Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-09-20 00:20 -0800
Re: Read (and parse) file on the web GS <gs@v.invalid> - 2016-09-17 11:14 -0400
Re: Read (and parse) file on the web Robert Baer <robertbaer@localnet.com> - 2016-09-18 00:18 -0800
Re: Read (and parse) file on the web GS <gs@v.invalid> - 2016-09-18 03:30 -0400
Re: Read (and parse) file on the web GS <gs@v.invalid> - 2016-09-15 05:02 -0400
Re: Read (and parse) file on the web - revised GS <gs@v.invalid> - 2016-09-17 17:15 -0400
csiph-web