简体   繁体   English

检索数据的最佳实践? SQL数据库与HTML解析

[英]Best practice for retrieving data? SQL Database vs HTML parsing

I'm developing an app that displays a list of products that are in stock from various electronics websites. 我正在开发一个应用程序,该应用程序显示各种电子网站上库存产品的列表。 I have two methods in mind for accomplishing this task. 我想到两种方法可以完成此任务。

  • Create a C# application that parses the html from the various websites and updates a SQL table, use a php script to get data from the SQL table, display it in JSON format, and parse the JSON with the iPhone 创建一个C#应用程序,该应用程序解析来自各个网站的html并更新SQL表,使用php脚本从SQL表中获取数据,以JSON格式显示数据,然后使用iPhone解析JSON
  • Use the iPhone to parse html from each website, eliminating the need for a server and SQL database 使用iPhone解析每个网站上的html,从而无需服务器和SQL数据库

I don't know all the pros and cons for each method, but I do know that hosting a web server with a SQL database costs money. 我不知道每种方法的优点和缺点,但是我知道使用SQL数据库托管Web服务器会花费很多钱。 However, using the iPhone to parse html from over 40 websites could be very slow, and use a lot of data. 但是,使用iPhone解析来自40多个网站的html可能非常慢,并且会使用大量数据。

Which one is the best method for creating an app like this? 哪种方法是创建此类应用程序的最佳方法? Am I even on the right track? 我是否在正确的轨道上?

Thanks, Miles 谢谢,迈尔斯

I would prefer the web service approach in which I would parse it on my own server and then serve a JSON representation to iPhone. 我更喜欢Web服务方法,在该方法中,我将在自己的服务器上对其进行解析,然后将JSON表示形式提供给iPhone。

Why? 为什么?

Because when something changes on the html you won't need to wait for Apple to confirm your app change, and user will not need to update his app. 因为当html上发生某些更改时,您无需等待Apple确认您的应用程序更改,并且用户无需更新其应用程序。

Your First Option is much prefered with little change. 几乎没有什么变化,您的首选就更受青睐。 You Don't Need C# TO parse the HTML as PHP has all options you need. 您不需要C#解析HTML,因为PHP具有所需的所有选项。 IT can save data in Database and similary can output in your desired format. IT部门可以将数据保存在数据库中,相似性可以以所需的格式输出。

As per the Cost, using Iphone may cost you more with data usage(Operator service Charges) as compare to web server hosting with PHP & mysql . 根据费用,与使用PHP & mysql托管Web服务器相比,使用Iphone可能会花费更多的数据使用费用(运营商服务费)。 Further you can have already optimised facilities of HTML parsing in own server with tendency to meet all complexities served on WEB. 此外,您可能已经在自己的服务器中优化了HTML解析功能,从而有可能满足WEB服务的所有复杂性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM