0

私は、この Web ページ ( http://consultawebvehiculos.carabineros.cl/index.php ) からの結果を使用する必要がある (楽しみのために) movil アプリケーションを作成することを計画しています。ネット コードでブラウザのインス​​タンスを作成し、この結果を読み取り、Web サービスを使用して公開する方法はありますか?

var IE= new broswer("http://consultawebvehiculos.carabineros.cl/index.php");
var result=IE.FindElementByID("txtIdentityCar").WriteText(YourIdentityCar);
publicToWebSerivce(result);

更新: Fiddler を使用すると、http 投稿が次のようなものであることがわかります。

POST http://consultawebvehiculos.carabineros.cl/index.php HTTP/1.1
Host: consultawebvehiculos.carabineros.cl
Connection: keep-alive
Content-Length: 61
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Origin: http://consultawebvehiculos.carabineros.cl
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.17 (KHTML, like Gecko)      Chrome/24.0.1312.57 Safari/537.17
Content-Type: application/x-www-form-urlencoded
Referer: http://consultawebvehiculos.carabineros.cl/index.php
Accept-Encoding: gzip,deflate,sdch
Accept-Language: es-ES,es;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

accion=buscar&txtLetras=CL&txtNumeros1=sk&txtNumeros2=12&vin=

PHPページに接続するには、webclientのような.Netクラスが必要かもしれません...わかりません。

更新:最終的に、Fiddler を使用して合計パラメーターを知るソリューションを見つけ、http://www.hanselman.com/blog/HTTPPOSTsAndHTTPGETsWithWebClientAndCAndFakingAPostBack.aspxのコードを使用しました。

4

2 に答える 2

1

ページのスクレイピングに興味がある場合は、HtmlAgilityPackを使用することをお勧めします。

ページも表示したい場合は、WebBrowserコントロールを使用できます。

于 2013-02-09T03:52:14.377 に答える
0

類似のタスクにはhttp://htmlunit.sourceforge.net/を使用しています。リクエストの送信、レスポンス/ステータス コードの受信などを行うことができます。

(これは Java ライブラリなので、Google で .Net ポートを検索するか、コンバーターを使用して Java アセンブリを .Net アセンブリに変換できます。http://blog.stevensanderson.com/2010/03/30/using-htmlunit-を参照してくださいon-net-for-headless-browser-automation/ガイダンス用.変換アプローチを使用しました)。

于 2013-02-09T23:29:21.660 に答える