Article View: borland.public.cppbuilder.internet.web
Article #1669Re: TCppWebBrowser doesn't return XML page ?
From: Mark Jacobs
Date: Tue, 24 Aug 2004 15:33
Date: Tue, 24 Aug 2004 15:33
52 lines
2628 bytes
2628 bytes
On Sat, 21 Aug 2004 21:37:41 +0200, Peter <Peter@smart-projects.net> wrote:
> I works 'nicely' for txt or html files with various content but the
> moment
> the first line says : <?xml version="1.0" ?> it doesn't work.
unsigned long mjgeturlconts(AnsiString url,AnsiString fnm)
{
char *bfr; unsigned long nmbyts=0,ba,br=1; FILE *fp;
HINTERNET
hss=InternetOpen("WhateverApp",INTERNET_OPEN_TYPE_DIRECT,NULL,NULL,0);
if (!hss) { ShowMessage("Could not Open Internet Session"); return 0;}
HINTERNET hsv=InternetOpenUrl(hss,url.c_str(),NULL,0,0,0);
if (!hsv) { ShowMessage("Could not Open Service "+url);
InternetCloseHandle(hss); return 0;}
InternetQueryDataAvailable(hsv,&ba,0,0);
if (ba==0) { ShowMessage("No Data Available at "+url);
InternetCloseHandle(hss); return 0;}
bfr=(char *)malloc((ba+9)*sizeof(char));
if (!bfr) { ShowMessage("Not Enough Memory - "+AnsiString(ba+9));
InternetCloseHandle(hss); return 0;}
fp=fopen(fnm.c_str(),"wb");
if (!fp) { ShowMessage("Could not Open File "+fnm); free(bfr);
InternetCloseHandle(hss); return 0;}
while (br!=0) { InternetReadFile(hsv,bfr,ba,&br);
fwrite(bfr,sizeof(char),br,fp); nmbyts+=br;}
fclose(fp); InternetCloseHandle(hss); hss=NULL; free(bfr);
return nmbyts;
}
url is the url you are trying to get whatever from, and fnm is the name of
the file you want to store it in.
HTH
--
Mark Jacobs
DK Computing
http://www.dkcomputing.co.uk
markj atty critical dotty co dotty uk
Technical Details
Message-ID:
<opsc8ticwebvaws7@dk-tzx09ucg42z4.s1.sol1.co.uk>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4127a516$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,7498d8e04b8d308a X-Google-Attributes: gidfeeec,public X-Google-Language: ENGLISH,ASCII-7-bit Newsgroups: borland.public.cppbuilder.internet.web Subject: Re: TCppWebBrowser doesn't return XML page ? Reply-To: markjattycriticaldottycodottyuk References: <4127a516$1@newsgroups.borland.com> Message-ID: <opsc8ticwebvaws7@dk-tzx09ucg42z4.s1.sol1.co.uk> Date: Tue, 24 Aug 2004 16:33:38 +0100 From: "Mark Jacobs" <markjattycriticaldottycodottyuk> Organization: DK Computing Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: Quoted-Printable User-Agent: Opera M2/7.53 (Win32, build 3850) NNTP-Posting-Host: 81.144.157.8 X-Trace: newsgroups.borland.com 1093361617 81.144.157.8 (24 Aug 2004 08:33:37 -0700) Lines: 52 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail