Paradox Community

Items in pnews.paradox-programming

Subject:Re: Downloading and saving as a csv via API Call
Date:Tue, 1 May 2018 10:28:04 +1000
From:Robert MacMillan <macfam@bigpond.net.au>
Newsgroups:pnews.paradox-programming
Hello Larry

it seems there may have been a problem at the server end yesterday. The 
code is now returning the information so all I need to now solve is how 
to not put it in a string but dump it complete into a .csv file. 
Obviously I could break it apart and do it that way but I am hoping that 
someone can point me in the direction of how to do it a simpler way.

There is also a problem in breaking it apart and processing it that way 
from the entire string in that there is no comma between the end of one 
record and the beginning of the next. So here is an example of that.

"4.4,84,74.14,25,900,13,8441493/05/2018,WNBL,Warrnambool"

So 844149 is the end of the preceding record and the next record starts 
with 3/05/2018, WNBL, etc. The 811149 can be any long integer and the 
date can be 13/05/2018 with no way of knowing for certain whether the 1 
is part of the previous integer at the end of the record or is part of 
the date.

Here is the code being used and it works very nicely for not only 
Betfair but other sites.

RequestURL = 
"http://www.puntingform.com.au/api/ratingsservice/getsouthcoastdata/standard/true/all?apikey=xxxxxxxxxxxxxxxxxxxxxxxx"
resultXMLstr2 = ""
err1 = ""
isOK = false

msgStr =""

try
	whichStep = "msXML Open"
	if oaXMLHTTP.open("Msxml2.XMLHTTP.3.0") then
		whichStep = "HTTP Open"
		oaXMLHTTP^open("GET",RequestURL, False)
		whichStep = "Send Data"
		oaXMLHTTP^send(msgStr)      ; sync so it'll wait
		resultXMLstr2 = oaXMLHTTP^responseText

		isOK = true
	endif
  onFail
  endTry
  if not isOK then
	 errorShow(whichStep)
	 return
  endif

On 1/05/2018 6:36 AM, Larry DiGiovanni wrote:
> Robert MacMillan wrote:
>
>> What I want to do is simply call it like I do the Betfair API, return
>
> How are you calling the Betfair API?
>
> To download static content, take a look at curl:  https://curl.haxx.se/
>
> You could shellexec a call to curl, passing it the URL and options to
> save the result as a named file.
>
> --
> Larry DiGiovanni
>


Copyright © 2004 thedbcommunity.com