Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to pull data from web into fmp ??

Status
Not open for further replies.

885611

MIS
May 6, 2006
4
MY
hello all experts,

i'm using fmp 8.0 ... i'm just wondering how can i (from fmp) access the internet (by clicking on a defined button for example) to a specific web-site and pull certain data back to fmp for further process (e.g. publish it) ...

for example, i wanna fmp to do this automatically from fmp :

- prompt user to enter stock symbol
- then goto this site (for example)
- inside the above site, retrieve the value of "StockScouter Rating" back to fmp
- display/publish this value within fmp

i think i've to use script ... but how do i do that ... the "Open URL" doesn't help much ... i wanna automate the process ...

appreciate if anyone can help ...

regards
fred
 
Fred,

Are you on Windows or Mac? I can possibly help if you're on Windows but if it's for a Mac I'm not your guy.

-Striker
 
striker,

i'm using windows xp ... appreciate if you can really help me ...

thanx
fred
 
Fred,

I don't have time to delve into this today but maybe tonight I can put something together. However, my method will involve VB scripting. Are you familiar with VB scripting and comfortable enough to work with it?

Also, are your running (Microsoft) Internet Explorer? I need to know because I will suggest that you have Filemaker call a VB script that opens IE in a hidden mode and writes the results to a text file. Then Filemaker can import the text file into a global field, parse (extract) the information and populate your record with the imformation.

This will get pretty complicated and I don't want to go to the effort if it gets too kludgy for your taste.

-Striker
 
striker,

i'm not really familiar with VB ... but i can pick it up if it's not too tedious (cause i used to be a programmer before) ... well, i do not want to make this too complicated as if it's like a nuclear-bomb project ...

yes, i'm using IE ... hmmm getting filemaker to call VB & do the processing bckgrnd sounds like a workaround but i bet it's gonna be really slow ...

but this sounds like too complicated and too cruel to exhaust yourself ... i thought if ms-excel can do the trick by abit of programming (bet it's VB as well) and present it straight onto excel, that would be much easier ...

the thing is i need to process multiple websites (for specific info) and present it onto filemaker ... it's like when i choose to enter "YHOO" and click, the whole process will be automated to retrieve info which i needed from 6-8 websites (maybe by assigning the value to variable temporary) and i can make decision thereafter ... i heard fmp can even process image and dump it onto fmp presentation ...

what i'm doing now is to goto individual webpage, get the info (cut & paste OR export into excel) into excel format and manually import it into fmp ... it's really time consuming ... that's why i'm thinking of the alternative ...

anyway striker, i have the time to get it but i'm just afraid it might not be fair to you to spend such a great effort on this ... but if it's ok with you, then i'm ready ...

cheers
fred
 
Fred,

I spent a few minutes with this tonight and had moderate success. The bad news is that the Yahoo page that you want to use displays that rating as an image rather than text. It will probably be a bit harder to extract but not impossible. Here is the basic VBScript:

' =================================
' VBScript to grab the content of a web page
' Author: T. Striker, May 8th, 2006
' =================================

Option Explicit

Dim oIE
Dim webPage
dim filesys, filetxt

' Create the IE object
Set oIE = CreateObject("InternetExplorer.Application")

' Create the file system object.
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.CreateTextFile("c:\pagecontent.txt", True)

' Set .Visible to True to make the bowser visible.
oIE.Visible = False

' The URL of the page that you want to return.
oIE.Navigate("
' Loop until the page is loaded
While oIE.Busy
Wend

' If you want both the page content and HTML.
'webPage = oIE.Document.DocumentElement.OuterHtml

' If you just want the page content.
webPage = oIE.Document.DocumentElement.innertext

' Write the results to a file on the local drive.
filetxt.WriteLine(webPage)

' Enable the next line to see the contents in a popup.
'MsgBox webPage

' Cleanup
oIE.Quit
Set oIE = Nothing

filetxt.Close
Set filesys = Nothing

******************************************

The script as written returns text content only. You can have it return both content and HTML tags which is what you will want to do and then search for the <img> tag that corresponds to the rating for a given number.

As far as Filemaker goes, you can have FM create the VBScript everytime you run the FM script or you can just pass it a parameter for the stock symbol along with the command to execute the script.

Fred, you said that you have some programming in your background so I won't get into the nitty-gritty but the basic steps are:

1. Have your FM Script launch the VBScript.
2. The VBScript opens the browser (hidden) and writes the contents of the web page to a .txt file somewhere on the local machine.
3. FM then IMPORTS the contents of the .txt file into a global field.
4. The FM script then parses out the Scouter Rating, finds the correct record, and updates the found record.

It's going to be a bunch of work to set this up but if you're doing a lot of this it could be time well spent.

Write back if you have anymore questions.

Good luck!

-Striker
 
thanx striker ... will try that out ...

cheers
fred
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top