Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: David Mustakim
  Where is David Mustakim?
 Jakarta
 Indonesia
 David Mustakim
 To: Usman Safdar
  Where is Usman Safdar?
 TS
 Pakistan
 Usman Safdar
 Tags
Subject: RE: Grab off Web
Thread ID: 365528 Message ID: 365591 # Views: 56 # Ratings: 0
Version: Visual FoxPro 9 Category: Windows 7 and VFP
Date: Friday, December 28, 2012 11:07:22 AM         
   


> > Here's a clipping on how to get exchange rates of various foreign denominations to Indonesian Rupiah:
> > Check your internet connection first:
> > DECLARE Long InternetCheckConnection IN Wininet.dll String Url,;
> > Long dwFlags, Long Reserved
> > lcUrl = "http://www.google.com"
> > IF InternetCheckConnection(lcUrl, 1, 0) <> 0
> > cStatus="Connected"
> > ELSE
> > cStatus="Not connected"
> > ENDIF
> >
> > If connected then execute:
> > oHTML = CreateObject("MSXML2.XMLhttp")
> > oHTML.open("GET", "http://www.depkeu.go.id/Ind/", .F.)
> > ohtml.send()
> > P3=oHTML.ResponseText
> > P2=""
> > P1='1px">'
> > cAUD=SUBSTR(P3,AT(P1,P3,5)+5,AT(P2,P3,35)-AT(P1,P3,5)-5)
> > cEUR=SUBSTR(P3,AT(P1,P3,8)+5,AT(P2,P3,38)-AT(P1,P3,8)-5)
> > cGBP=SUBSTR(P3,AT(P1,P3,11)+5,AT(P2,P3,41)-AT(P1,P3,11)-5)
> > cJPY=SUBSTR(P3,AT(P1,P3,14)+5,AT(P2,P3,44)-AT(P1,P3,14)-5)
> > cSGD=SUBSTR(P3,AT(P1,P3,17)+5,AT(P2,P3,47)-AT(P1,P3,17)-5)
> > cUSD=SUBSTR(P3,AT(P1,P3,20)+5,AT(P2,P3,50)-AT(P1,P3,20)-5)
> >
> > Edit: this method however depends very much on the webpage not changing its layout which would make P2 and P1 values need adjustments
> >
> > David
> > ..
> > .
> >
> >
> >
>
> Dear David, this portion is not working
> cAUD=SUBSTR(P3,AT(P1,P3,5)+5,AT(P2,P3,35)-AT(P1,P3,5)-5)
> cEUR=SUBSTR(P3,AT(P1,P3,8)+5,AT(P2,P3,38)-AT(P1,P3,8)-5)
> cGBP=SUBSTR(P3,AT(P1,P3,11)+5,AT(P2,P3,41)-AT(P1,P3,11)-5)
> cJPY=SUBSTR(P3,AT(P1,P3,14)+5,AT(P2,P3,44)-AT(P1,P3,14)-5)
> cSGD=SUBSTR(P3,AT(P1,P3,17)+5,AT(P2,P3,47)-AT(P1,P3,17)-5)
> cUSD=SUBSTR(P3,AT(P1,P3,20)+5,AT(P2,P3,50)-AT(P1,P3,20)-5)
>
> anyhow, P3 var fetch data from the specified web.



I just knew that, it used to work perfectly; apparently P2 and P1 values now have to be adjusted according to latest changes in the layout of the webpage referred to.

David
..
.

ENTIRE THREAD

Grab off Web Posted by Chris Sharp @ 12/27/2012 5:42:02 PM
RE: Grab off Web Posted by Russell Hill @ 12/27/2012 8:00:07 PM
RE: Grab off Web Posted by Pete Sass @ 12/28/2012 1:53:58 AM
RE: Grab off Web Posted by David Mustakim @ 12/28/2012 3:45:53 AM
RE: Grab off Web Posted by Usman Safdar @ 12/28/2012 10:54:17 AM
RE: Grab off Web Posted by David Mustakim @ 12/28/2012 11:07:22 AM
RE: Grab off Web Posted by Usman Safdar @ 12/28/2012 6:51:02 PM
RE: Grab off Web Posted by David Mustakim @ 12/29/2012 12:04:29 AM
RE: Grab off Web Posted by Usman Safdar @ 12/29/2012 11:21:02 AM
RE: Grab off Web Posted by David Mustakim @ 12/29/2012 11:29:07 AM