2

What drawbacks are there in using "scraping" techniques and tools like http://simplehtmldom.sourceforge.net/ if you need to display content in a different template and domain like "m.mysite.com" for a mobile version of your site? I understand that the traditional way to do this is to hook into your database and write SQL queries to access what you need.

However, my SQL knowledge is lacking and the DB is quite complex using a custom CMS (I didn't build the site originally) . Everything that I need is on the front-end and I can access each piece with Simple DOM and place it in a jQuery Mobile template.

The only drawback that I can see is that if someone changes class or an id on the main site it could break the mobile site. But what are the other implications? Would a mobile site built like this be slow to load even if the main site it is based off of loads fast? Anything else I'm missing?

Also, isn't this basically how services like http://www.dudamobile.com/ work? They certainly don't have access to your DB.

Thanks for any help.

Erik Berger
  • 599
  • 1
  • 10
  • 24
  • SimpleHtmlDom is rather slow and memory hungry compared to native solutions. You might want to [consider using an alternative based on libxml](http://stackoverflow.com/questions/3577641/how-to-parse-and-process-html-with-php/3577662). Can't help with the other stuff. Don't get what you are trying to do. – Gordon Jul 19 '13 at 20:55
  • Thanks @Gordon. That is helpful. I'm just trying to make a mobile version of a site by scraping the DOM instead of accessing the database. – Erik Berger Jul 19 '13 at 21:12

1 Answers1

0

If I were you, I would develop a high level API and use it with templating engine. Once you do this, you have the API, which you can always use easily to obtain data from your database. Also, using templating engine gives you the ability to display the same information across different templates.

Noor
  • 19,638
  • 38
  • 136
  • 254