simple-html-dom

How to pull the image and title of the product from site of amazon?

杀马特。学长 韩版系。学妹 提交于 2019-12-10 17:55:12
问题 I am trying to make a list of products based on the unique product codes of amazon for example: https://www.amazon.in/gp/product/B00F2GPN36 Where B00F2GPN36 is the unique code. I want to fetch the image and the title of the product into an Excel list under the columns product image and product name. I have tried many times using the html.getElementsById("productTitle") and html.getElementsByTagName but there is always a problem while running the code and I am unable to solve it, so please

How to get the absolute image URIs with SimpleHTMLDom [duplicate]

烂漫一生 提交于 2019-12-10 11:41:41
问题 This question already has answers here : How to extract complete sub links using Simple-HTML-DOM? (3 answers) Closed 6 years ago . I use simple_html_dom to get site's images. But sometimes, the image's link are not prefixed with the full domain URI, e.g. with http://example.com . They appear as something like images/_home-ss-21.jpg /_home-ss-22b.jpg ./_1249a7s.png or ../../../a19489s_20110412.jpeg. How to can I convert these URIs to absolute URIs including the protocol and domain information.

Get text with PHP Simple HTML DOM Parser

泄露秘密 提交于 2019-12-10 00:20:28
问题 i'm using PHP Simple HTML DOM Parser to get text from a webpage. The page i need to manipulate is something like: <html> <head> <title>title</title> <body> <div id="content"> <h1>HELLO</h1> Hello, world! </div> </body> </html> I need to get the h1 element and the text that has no tags. to get the h1 i use this code: $html = file_get_html("remote_page.html"); foreach($html->find('#content') as $text){ echo "H1: ".$text->find('h1', 0)->plaintext; } But the other text? I also tried this into the

Find text without any tag in a div element

拥有回忆 提交于 2019-12-09 01:49:03
问题 I need to access the 48.20 Lac(s) text which is without any tag inside the div,which is the reason I'm not able to access it. I need to find this in a PHP file.I've tried $html->find('div.priceDetail') followed with trim(strip_tags($result)) which gave me 48.20 Lac(s) + unnecesary text. Since I've to build a generic file I can't depend on exploding and imploding for a particular fixed case. <div class="priceDetail"> <b>Total Price :</b> <img alt="" src="someimage">48.20 Lac(s) <!-- Per Sq Ft

How do I find this div ? (PHP Simple HTML DOM Parser)

徘徊边缘 提交于 2019-12-08 19:31:31
问题 This is my code: <?php include('simple_html_dom.php'); $html = file_get_html('http://www.google.com/search?q=BA236',false); $title=$html->find('div#ires', 0)->innertext; echo $title; ?> It outputs all result of the Google Search Page under the Search "BA236". The problem is I dont need all of them and the Information I need is inside a div that has no id or class or anything else. The div I need is inside the first <div class="g"> on the Page, so maybe I should try something like this: <?php

Simple HTML Dom - Fatal error when using load_file

人盡茶涼 提交于 2019-12-08 16:39:24
问题 I'm trying to parse an HTML file that has terrible (believe me, it is) HTML structure and because of this and my lack of knowledge, I couldn't write my own parser. Later I tried using Simple HTML Dom parser, because a lot of people (on SO as well) recommend it. I required the simple_html_dom.php, then created the object. They seem to work, the require() function returns "1" and var_dump()-ing the object returns an object. After this I tried to load the URL as it was done in the manual, but I

Simple dom parser insert into database

删除回忆录丶 提交于 2019-12-08 13:02:08
问题 i want to insert some elements in my database, but i want that $pavadinimas and %kaina be in one line, not different. Moreover it will be pretty cool if i could generate my elements in all pages from website, but then I insert more than 2 links i get error from refreshing my web that page could not load. Here is my code. Thanks for help! <?php // example of how to modify HTML contents include_once('simple_html_dom.php'); // Create DOM from URL or file $html = file_get_html('https://www.varle

How can I create DOM object from a HTML file in php language?

醉酒当歌 提交于 2019-12-08 10:52:38
问题 I want to parsing data from homepage on this url. As you can see this url is HTML file and I read below: // Create a DOM object from a HTML file $html = file_get_html('test.htm'); so I just type a code below include "simple_html_dom.php"; $html = file_get_html('eecs.kookmin.ac.kr/site/computer/notice.htm'); echo $html->plaintext; The error message is: Error message Warning: file_get_contents(eecs.kookmin.ac.kr/site/computer/notice.ht‌​m): failed to open stream: No such file or directory in C:

PHP Simple HTML DOM Parser finding specific text

六眼飞鱼酱① 提交于 2019-12-08 10:44:40
问题 Trying to get data from this poorly created HTML format http://www.weather.gov.sg/lws/zoneInfo.do All I need is to get data for 3 places, e.g. Bedok, City and Katong. How do I store the data in an array for this? This is what I did to get the store the first 5 lines, which is not exactly what I want. $row_counter='0'; while($row_counter<5) { $ret['Name'][] = $html->find('.FORM1', $row_counter)->innertext; $ret['Area'][] = $html->find('.FORM1', $row_counter)->next_sibling()->innertext; $ret[

Simple html dom - how get dt/dd elements to array? [duplicate]

扶醉桌前 提交于 2019-12-08 07:33:16
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Get data only from html table used preg_match_all in php HTML: <div class="table"> <dl> <dt>ID:</dt> <dd>632991</dd> <dt>Type:</dt> <dd>NEW</dd> <dt>Body Type:</dt> <dd>Compact</dd> </dl> </div> What's is the best way to get this using simple_html_dom in PHP: PHP: $option = array( 'id' => 632991, 'Type' => 'NEW', 'Body Type' => 'Compact' ); 回答1: You could use XPath: Getting DOM elements by classname Get Element