|
Pages: [1]
|
 |
|
Author
|
Topic: Help saving results from function on local webserver... (Read 821 times)
|
|
|
|
Graham
|
data contains the result of you read operation.
If you want to save it, just write it to your local drive
write %saved.txt data
should do it ...
|
|
|
|
|
Logged
|
|
|
|
|
revel
|
Hi, Thanks for the reply. I should have asked the question better and in this case store was the wrong word. What I was trying to say was that the above code does not return the trade results and thus incorrect. in the browser, this is entered http://127.0.0.1:16239/req?GetHistory(kse:@ksu6,0,0,1D) which then returns OK 09/13/2005,150.10,150.10,149.05,149.40,3 09/14/2005,150.50,152.50,150.50,152.50,2 09/15/2005,152.55,152.55,152.55,152.55,1 09/21/2005,154.85,154.85,154.85,154.85,1 09/22/2005,154.60,154.60,154.60,154.60,1 09/26/2005,152.00,156.00,152.00,156.00,3 09/27/2005,155.60,155.60,155.50,155.50,2 09/28/2005,157.30,158.00,156.85,158.00,3 09/29/2005,158.00,158.90,158.00,158.90,3 10/04/2005,159.85,160.90,159.85,160.90,2 10/05/2005,158.30,158.30,157.20,157.20,5 10/06/2005,154.30,154.30,154.20,154.20,2 10/07/2005,154.60,154.60,154.50,154.50,2 10/11/2005,157.90,159.10,157.20,159.10,3 in rebol, when entering in console >> data: read http://127.0.0.1:16239/req?GetHistory(kse:@ksu6,0,0,1D) == kse:@ksu6,0,0,1D >> print data Error: requires 4 arguments >> It does not return the expected trade data from the running local server. I suspect it may be due to the ( ) in the url which causes the problem but I;m not quite sure how to solve that
|
|
|
|
|
Logged
|
|
|
|
|
Gabriele
|
data: read http://127.0.0.1:16239/req?GetHistory%28kse:@ksu6,0,0,1D%29
You just need to escape the parens with %28 and %29.
|
|
|
|
|
Logged
|
|
|
|
|
revel
|
Hi, Not quite there yet. It seems that the @ sign is in the way. Not sure whether the other remaining punctuations like : or , will affect as well. >> data: read http://127.0.0.1:16239/req?GetHistory%28kse:@ksu6,0,0,1D%29** Access Error: Cannot connect to ksu6,0,0,1D ** Where: open-proto ** Near: data: read http://127.0.0.1:16239/req?GetHistory%28kse:@ksu6,0,0,1D%29>> This is what I tried, which from to-url gave the same escape %28 and %29 as you mentioned. However, it seems the @ and perhaps other punctuation are causing confusion. >> weburl: to-url http://127.0.0.1:16239/req?GetHistory(kse:@ksu6,0,0,1D) == http://127.0.0.1:16239/req?GetHistory%28kse:@ksu6,0,0,1D%29>> read weburl ** Access Error: Cannot connect to ksu6,0,0,1D ** Where: open-proto ** Near: read weburl >> print weburl http://127.0.0.1:16239/req?GetHistory(kse:@ksu6,0,0,1D)
|
|
|
|
« Last Edit: June 26, 2006, 05:15:36 AM by revel »
|
Logged
|
|
|
|
|
revel
|
Just tried a simpler ticker symbol ie qqqq and it works >> weburl: to-url " http://127.0.0.1:16239/req?GetHistory(qqqq,0,0,1D)" == http://127.0.0.1:16239/req?GetHistory%28qqqq,0,0,1D%29>> data: read weburl == {OK 06/21/2005,37.83,38.01,37.70,37.85,90041500 06/22/2005,38.00,38.10,37.63,37.83,72538200 06/23/2005,37.89,38.18,37.33,37.37,1... >> print data OK 06/21/2005,37.83,38.01,37.70,37.85,90041500 06/22/2005,38.00,38.10,37.63,37.83,72538200 06/23/2005,37.89,38.18,37.33,37.37,114012800 06/24/2005,37.38,37.41,36.96,36.96,136221600 . . . etc so a simple ticker symbol like qqqq works fine, however the more complex ticker symbol kse:@ksu6 returns errors as mentioned above...
|
|
|
|
|
Logged
|
|
|
|
|
Gord
|
My guess is that the username, password and host site are not being transferred properly in the url. I have seen a syntax similar to the following:
username:password@URL
and the full URL that you gave us seems to be missing the password after the colon and URL after the "@" sign, (although I guess the "ksu6" could be the URL with the 0,0,1D as additional parameters). In this case the interpreter is trying to use "ksu6,0,0,1D" as the URL with no parameters.
|
|
|
|
|
Logged
|
|
|
|
|
revel
|
hi, it would seem that there's probably some convention such as that which you mentioned or perhaps just email@domain.com which causes rebol interpreter to not pass the full string as is and instead attempts to interpret the @ sign. the local webserver application has a few functions with defined parameters. there is no password required as a parameter in this case. at least with a simple ticker symbol like qqqq it works. Is there a way to escape the @ character like for the ( ) . the to-url function will not convert the @ character as oftentimes that would be the desired behaviour. Is there a generic way to handle this scenario of ticker symbols with "special" punctuations in them? Another ticker symbol format has the # instead of the @.
|
|
|
|
|
Logged
|
|
|
|
|
Gabriele
|
I'm not sure if @ is allowed in URL paths. Anyway, a general solution is: read [ scheme: 'http host: 127.0.0.1 port-id: 16239 target: "/req?GetHistory(kse:@ksu6,0,0,1D)" ]
or maybe: read [ scheme: 'http host: 127.0.0.1 port-id: 16239 path: "/" target: "req?GetHistory(kse:@ksu6,0,0,1D)" ]
This way you bypass REBOL's URL parsing completely.
|
|
|
|
|
Logged
|
|
|
|
|
revel
|
Hi,
Yes it finally works. I removed the / in the target string. Other then that everything seems just fine. Thanks !
data: read [ [ scheme: 'http [ host: 127.0.0.1 [ port-id: 16239 [ target: "req?GetHistory(kse:@ksu6,0,0,1D)" [ ] connecting to: 127.0.0.1 == {OK 09/13/2005,150.10,150.10,149.05,149.40,3 09/14/2005,150.50,152.50,150.50,152.50,2 09/15/2005,152.55,152.55,152.55,152.55,1 0...
|
|
|
|
|
Logged
|
|
|
|
|
|
Pages: [1]
|
|
|
 |
News: 01-09-08 Alpha version of REBOL 3 has been released!
2293 Posts in 593 Topics by 3751 Members
Latest Member: BSwewattest
|