URL_Fetcher examples
Jon Abbott (1421) 2651 posts |
Are there any examples on how to use the URL_Fetcher Module? It only ever seems to return a status of 0 – which isn’t valid, so I must be doing it wrong. eg.
EDIT: Example code to download a file
|
Chris Mahoney (1684) 2165 posts |
You need to call URL_ReadData before it’ll actually return anything. URL_GetURL only starts off the process. |
Jon Abbott (1421) 2651 posts |
I’m doing that, but as stated above it only returns zero, which is why I’m after a code example. From the documentation, my snippet above looks correct in that it should eventually return a status to say it’s connected. Once connection is established, you then read the data via URL_ReadData. |
Chris Mahoney (1684) 2165 posts |
I haven’t tried using the module from BASIC. I’m happy to share the C source to HTTPLib if you like, although it’s not exactly a simple example :) |
Jon Abbott (1421) 2651 posts |
Yes please, as you’re doing exactly what I’m trying to do but in BASIC. |
Chris Mahoney (1684) 2165 posts |
I’ve put the source on my site, under HTTPLib. |
Jon Abbott (1421) 2651 posts |
Thanks. Shame that isn’t in a Module so it can be used from BASIC as you’ve already coded exactly what I’m trying to code. Turns out I was doing it correctly, but URL_GetURL doesn’t appear to actually do anything, so calling URL_Status after it and waiting for connection confirmation was never going to work. |
Bryan (8467) 468 posts |
Has anybody got any examples of code written in BASIC |
Jon Abbott (1421) 2651 posts |
I’ve put my example code in the OP. I’m not sure why Textile has completely knackered the formatting, I’ll sort it out later. |