Answer the question
In order to leave comments, you need to log in
How to implement price parsing from sites for certain products?
How to implement price parsing from sites for certain products, the first thing that comes to mind is to write regular expressions for each store, but it’s somehow not beautiful, use libraries for parsing, or is there a more elegant way?
Answer the question
In order to leave comments, you need to log in
phpQuery - selection can be done as in jQuery . For simple tasks - it is quite suitable.
Option for PHP. I was engaged in price parsing, first I parsed regulars. Then I found a more elegant way. In my opinion the best way is XPath. We load the page with curl or file_get_contents, add <?xml encoding="UTF-8"> before it, load it all into a DOM object, then calmly parse using queries =)
I once used jsoup.org - a parser in Java, you can rip out data by css selectors - it turned out to be very convenient.
You can think about a similar option, as done in Google Webmaster - a marker.
That is, the page is loaded into a special web interface, the administrator indicates which part of the data is on the page - which means. Then the system automatically pulls up several other pages-similar-templates to clarify the information. This will allow you to quickly install parsing for any online store. True, this is not easy, perhaps you need to use neural networks. Or look for open analogues.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question