Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / [Answered]Can we download url source code?

Author
Message
Battoad
AGK Developer
17
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 14th Jan 2015 17:44
I am in the process of trying to convert some of my earlier DBPro Apps in to AppGameKit apps. A few of these apps need to download web source codes, previously I may have used the urlmon.dll to assist.
Is there anything built in to AppGameKit that can do the equivalent?

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 14th Jan 2015 18:07
The HTTP COmmands:

Quote: "CloseHTTPConnection
CreateHTTPConnection
DeleteHTTPConnection
GetHTTPFile
GetHTTPFileComplete
GetHTTPFileProgress
GetHTTPResponse
GetHTTPResponseReady
GetInternetState
OpenBrowser
SendHTTPFile
SendHTTPRequest
SendHTTPRequestASync
SetHTTPHost
SetHTTPTimeout"


Quidquid latine dictum sit, altum sonatur
Battoad
AGK Developer
17
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 14th Jan 2015 19:46
Quote: "The HTTP Commands:"


Thanks for a list of standard AppGameKit html commands which I know are listed in the help files, however your reply doesn't really answer my question unless you really meant to say - "No".

Has anyone found a way to do this using AGK2 tier 1 ?

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 14th Jan 2015 20:57
I just ran the HTTP Communication example that comes with AGK. I edited 2 lines to grab the source html for a BBC news page:

g_Net_Connected = SetHTTPHost ( g_Net_Connection, "www.bbc.co.uk", 0 )

and

download$ = "news/uk-politics-30808252"

I got the HTML for the page. Is that what you mean?

Quidquid latine dictum sit, altum sonatur
Battoad
AGK Developer
17
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 14th Jan 2015 21:26
Quote: "Is that what you mean?"


Many thanks BatVink.
I don't recognise any of your above coding but it sounds like what I am looking for. I will need to study this a bit to try to understand the AppGameKit example mentioned together with your modifications.
Thanks again, especially for persevering.
Cheers.

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 14th Jan 2015 23:43
You can take the AppGameKit example and use it with just 2 changes to the lines above.

Line 11 in the code is the SetHTTPHost. Simply set it to your root URL.

Line 23 is the rest of the URL, and this is placed in variable download$.

This is how the example code looks with the 2 changes:



Quidquid latine dictum sit, altum sonatur
Battoad
AGK Developer
17
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 15th Jan 2015 12:41
The above is a good example of how to download a web page html file but not the original source as a .txt file, equivalent to pressing Ctrl+U on the html web page.

Sorry if I misled you but it is this .txt source that I would like to download not the html.

So far i have been unable to find a suffix to add to the url to obtain this source.txt, if indeed that is the way to do it.

Battoad
AGK Developer
17
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 15th Jan 2015 12:49
Sorry for double post, but just as I sent the above I realised that I just needed to change .html to .txt.

This works fine, thank you.

As I said earlier, I am in the process of trying to upgrade many of my earlier DBPro projects in to AGK. I regret making the change so late as I didn't realise how good AppGameKit is.
I cant recommend it enough and suggest other DBPro users to make the switch now - its brilliant.
I hope to get something in the Showcase soonish.

Thank you both BatVink and TGC.

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 24th Jan 2015 15:14
Quote: "The above is a good example of how to download a web page html file but not the original source as a .txt file"


You seem to be confused about what "source code" actually means. Extensions don't mean anything. The HTML source is text, as you've found out by now.


"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Battoad
AGK Developer
17
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 26th Jan 2015 21:13
Quote: "You seem to be confused about what "source code" actually means."


Not really, just had a bad moment. It was the extension that I was concerned about but realised this just after I sent the post.

Nothing like a constructive post though!

Login to post a reply

Server time is: 2024-11-23 08:17:18
Your offset time is: 2024-11-23 08:17:18