View previous topic :: View next topic |
Author |
Message |
harrys Newbie
Joined: 25 Feb 2007 Posts: 22
|
Posted: Thu Jun 01, 2017 5:37 pm Post subject: get internet file |
|
|
so i need to get a .json file and save it as text
without using shell and firefox.
is there a freeware dll for internet file operations?
UPDATE>>>
tried vdsinet.dll NET HTTP, DOWNLOAD,
but all i get is a bad file , using same address in firefox
correct file is displayed ??? any clues ?
short of that, any ideas how to save the file after its loaded
in firefox? without window send !!!
thanks
i'm still on vds4.5
Code: |
list create,1,
external vdsinet.dll,Public Freeware Key|90257236
rem NET HTTP, DOWNLOAD, "http://api.wunderground.com/api/<mykey>/conditions/q/WA/pws:KWALANGL5.json","F:\weather\weatherdata.txt"
shell open,"C:\Program Files\Mozilla Firefox\firefox.exe","http://api.wunderground.com/api/<mykey>/conditions/q/WA/pws:KWALANGL5.json"
list loadfile,1,F:\weather\weatherdata.txt
rem list loadfile,1,F:\weather\pws KWALANGL5.json
|
RETURN FROM VDSINET.DLL
Code: |
Server: AkamaiGHost
Mime-Version: 1.0
Content-Type: text/html
Content-Length: 209
Expires: Thu, 01 Jun 2017 19:28:40 GMT
Date: Thu, 01 Jun 2017 19:28:40 GMT
Connection: close
<HTML><HEAD>
<TITLE>Invalid URL</TITLE>
</HEAD><BODY>
<H1>Invalid URL</H1>
The requested URL "[no URL]", is invalid.<p>
Reference #9.6eb31bb8.1496345320.30a631f0
</BODY></HTML> |
RETURN FROM FIREFOX
Code: |
{
"response": {
"version":"0.1",
"termsofService":"http://www.wunderground.com/weather/api/d/terms.html",
"features": {
"conditions": 1
}
}
, "current_observation": {
"image": {
"url":"http://icons.wxug.com/graphics/wu2/logo_130x80.png",
"title":"Weather Underground",
"link":"http://www.wunderground.com"
},
"display_location": {
"full":"Langley, WA",
"city":"Langley",
"state":"WA",
"state_name":"Washington",
"country":"US",
"country_iso3166":"US",
"zip":"98260",
"magic":"1",
"wmo":"99999",
"latitude":"48.026367",
"longitude":"-122.406273",
"elevation":"21.6"
},
"observation_location": {
"full":"Upper Langley - Flying Bear Farm, Langley, Washington",
"city":"Upper Langley - Flying Bear Farm, Langley",
"state":"Washington",
"country":"US",
"country_iso3166":"US",
"latitude":"48.026367",
"longitude":"-122.406273",
"elevation":"262 ft"
},
"estimated": {
},
"station_id":"KWALANGL5",
"observation_time":"Last Updated on June 1, 12:28 PM PDT",
"observation_time_rfc822":"Thu, 01 Jun 2017 12:28:18 -0700",
"observation_epoch":"1496345298",
"local_time_rfc822":"Thu, 01 Jun 2017 12:28:43 -0700",
"local_epoch":"1496345323",
"local_tz_short":"PDT",
"local_tz_long":"America/Los_Angeles",
"local_tz_offset":"-0700",
"weather":"Overcast",
"temperature_string":"59.4 F (15.2 C)",
"temp_f":59.4,
"temp_c":15.2,
"relative_humidity":"35%",
"wind_string":"Calm",
"wind_dir":"SW",
"wind_degrees":225,
"wind_mph":0.0,
"wind_gust_mph":0,
"wind_kph":0,
"wind_gust_kph":0,
"pressure_mb":"1013",
"pressure_in":"29.92",
"pressure_trend":"0",
"dewpoint_string":"32 F (-0 C)",
"forecast_url":"http://www.wunderground.com/US/WA/Langley.html",
"history_url":"http://www.wunderground.com/weatherstation/WXDailyHistory.asp?ID=KWALANGL5",
"ob_url":"http://www.wunderground.com/cgi-bin/findweather/getForecast?query=48.026367,-122.406273",
"nowcast":""
| [/code] |
|
Back to top |
|
|
PGWARE Web Host
Joined: 29 Dec 2001 Posts: 1562
|
Posted: Fri Jun 02, 2017 2:31 am Post subject: |
|
|
Try the VDSIPP library. You may need to set the user-agent to something like Firefox, Internet Explorer if the webserver is trying to detect which browser is loading it. Or the server you are connecting to is configured to serve pages with compression. |
|
Back to top |
|
|
harrys Newbie
Joined: 25 Feb 2007 Posts: 22
|
Posted: Fri Jun 02, 2017 3:52 am Post subject: |
|
|
thats the ticket !!!
thanks |
|
Back to top |
|
|
harrys Newbie
Joined: 25 Feb 2007 Posts: 22
|
Posted: Mon Jun 05, 2017 4:42 am Post subject: |
|
|
when checking the file that is DL from INTERNET HTTP,DOWNLOAD (ipp.dll)
i find that it is just a stream of text with no line breaks
anyway to get the file to DL as it is displayed with @cr
as per my earlier posts??
thanks |
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Tue Jun 06, 2017 2:34 pm Post subject: |
|
|
If you have VDS6 you can just use File Copy. It supports getting from HTTP. It will not work on HTTPS, but I use File Copy a lot for internet files.
File Copy, "http://api.wunderground.com/api/<mykey>/conditions/q/WA/pws:KWALANGL5.json","F:\weather\weatherdata.txt"
EDIT: Never mind, I see you are using 4.5. Sorry _________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
harrys Newbie
Joined: 25 Feb 2007 Posts: 22
|
Posted: Tue Jun 06, 2017 7:32 pm Post subject: |
|
|
thanks for the response ....
after downloading seems if you open the .json file with the word- rtf editor save it as a text file and its nicely formatted..
but if its straight to a ascii file or into VDS lists
it doesn't see the CR and its just a stream of text .
EDIT: this works to put back in the CR's in the text file
Julian thanks for that @text() function!!
%z = @curdir()
list create,1
list loadfile,1, %z\weatherdata.json
%%cleanfile = @text(1)
rem info %%cleanfile
list savefile,1,%z\weatherdata_test1.txt
list close,1 |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|