开发者

redirect web app results to own application

Is it possible to redirect a web apps results to a second application? I cannot parse the html source. It contains the javascript functions that execute the queries but all the content is probably server side.

I hope this makes sense. The owner has made the script available but I am 开发者_如何学Cnot sure how this helps. Can I using .net call the site and redirect results perhaps to a file or database?

the app accesses one of googles apis and performs searches/queries and returns results which are displayed on the site. Now all the javascript functions that perform these queries are listed in the source but I do not know javascript so it does not make much sense to me. I have used the documentation which uses the oauth protocol to access the api and have implemented that in my web app but it took me nearly a week to get the request token right and now to send requests to the api, sometimes I get one result back and sometimes none. It is frustrating me and the owner of the web app has given use of his script but he says all that happens is that my browser interacts with the google api and not his server.

So I thought why not have my web app call his, since his interacts with the API flawlessly and have the results sent to my app to save in a database.

I have very little experience here so pardon my ignorance


If you don't want to learn the Google APIs, you could load that page in a minimized inline frame and then grab the results from it with JavaScript. It will be a lot of coding on your behalf, but it's doable. So, it's just to bite the sour apple and learn JavaScript. ;)


It sounds like Application1 needs to call a URL on Application2, and do something with the results.

You can use WebClient:

Public Sub GetUrlContents(URL As String ) 'call this method using Application2's URL

    ' Get HTML data
  Try
    Dim fileReader As New WebClient()
    Dim byteArray As Byte()
    Dim addr As Uri
    Dim content As String

    addr = New Uri("http://www.foo.com/") //use URL in param list instead.
    byteArray = fileReader.DownloadData(addr)
    content = System.Text.Encoding.ASCII.GetString(byteArray)

    'save to file or database instead.
    Console.WriteLine(content)

  Catch ex As HttpListenerException
     Console.WriteLine("Error accessing site " + ex.Message)
  Catch ex As Exception
     Console.WriteLine("Error accessing site " + ex.Message)
 End Try


End Sub
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜