Questions tagged [simpledom]

A bridge between SimpleXML and the DOM extension, plus a bunch of convenience methods

SimpleDOM is built upon SimpleXML and acts as a bridge providing DOM methods using SimpleXML's syntax. It also adds a bunch of convenience methods.

SimpleDOM is a single file with no dependencies. All you need to use it is include it and create SimpleDOM objects instead of SimpleXMLElement objects, or simply use simpledom_load_string() instead of simplexml_load_string().

URL: http://code.google.com/p/simpledom/

77 questions
10
votes
9 answers

How to extract title and meta description using PHP Simple HTML DOM Parser?

How can I extract a page's title and meta description using the PHP Simple HTML DOM Parser? I just need the title of the page and the keywords in plain text.
Henry The Least
  • 619
  • 3
  • 11
  • 20
5
votes
2 answers

Adding a block of XML as child of a SimpleXMLElement object

I have this SimpleXMLElement object with a XML setup similar to the following... $xml = << ABCD EOX; $sx = new SimpleXMLElement( $xml ); Now I have a class named Book that contains…
miCRoSCoPiC_eaRthLinG
  • 2,910
  • 4
  • 40
  • 56
4
votes
1 answer

simplexml doesnt load tag classes?

I have a bit of php that grabs the html from a page and loads it into a simplexml object. However its not getting the classes of the element within a The php //load the html page with curl $html = curl_exec($ch); curl_close($ch); $doc = new…
Paul M
  • 3,937
  • 9
  • 45
  • 53
3
votes
1 answer

simple dom parser double find() doesn't work?

Above is my DOM and I expect to get 4 hour ago but I got an error Fatal error: Call to a member function find() on a non-object My php look like this $time_ago = $html->find('.entry .unvoted',0)->find('.tagline…
Elton Jamie
  • 586
  • 6
  • 17
3
votes
2 answers

PHP Simple HTML DOM Parser: how to get contents of the parent div containing

tags?

I'm scraping (using PHP simple HTML DOM) a number of different (news) sites with the aim of getting the main content/body of text on the page. To do this the best way i could figure out was to find the main header/headline (H1) and to get the text…
grimagon
  • 43
  • 1
  • 6

2
votes
3 answers

How do you access Simple DOM selectors?

I can access some of the 'class' items with a $ret = $html->find('articleINfo'); and then print the first key of the returned array. However, there are other tags I need like span=id"firstArticle_0" and I cannot seem to find it. $ret =…
user723220
  • 817
  • 3
  • 12
  • 20
2
votes
2 answers

How do you fix sentence spacing on extracted plain text from HTML?

I'm pulling articles from specific URLs for conversion to sentences, but the text body has a random behavior of eliminating whitespace between some sentences resulting in: Jane went to the store.She bought a dog. The dog was very friendly.It had no…
user723220
  • 817
  • 3
  • 12
  • 20
2
votes
1 answer

Foreach explode trim take last date simple dom parser

I want to take only last date from the third div counting from text div, using foreach below is my code It only shows the date 01.01.1970 i cant get the date and compare it to today dates ------------- Part of the page i want to crawler
r0adtr1p
  • 61
  • 8
2
votes
3 answers

How to find all element with PHP Simple HTML DOM Parser?

// Find all element has attribute id $ret = $html->find('*[id]'); This is an example for finding all elements which have attribute id. Is there any way to find all elements. I try this way but it does not work: // Find all element $ret =…
Manhhailua
  • 1,062
  • 3
  • 13
  • 33
2
votes
1 answer

redeclare file_get_html simple_html_dom.php

I am using simple html dom to parse itunes preview page When I put URL in code [download]url[/download] once everything okey, but when I have 2 or more [download]url[/download] codes I getting an error Fatal error: Cannot redeclare file_get_html()…
nik1004
  • 327
  • 3
  • 11
1
vote
1 answer

SimpleDOM.php - Issues with sortedXPath

I have a little problem with the usage of SimpleDOM and sortedXPath. Given is the following XML Structure. I want to sort it either by row id, name or birthday. Jimmy
Cabal
  • 11
  • 1
1
vote
0 answers

PHP scraping information from another URL, Blank page or E_NOTICE : type 8 -- Trying to get property of non-object

basically I'm trying to make a small tracking plugin for my website, and I'm not sure what I am meant to put get the correct name for the element ID. I either get a blank screen or E_NOTICE : type 8 -- Trying to get property of non-object I just…
xtraele
  • 11
  • 1
1
vote
2 answers

Simple_Dom Error: file_get_contents(): stream does not support seeking in Laravel

I'm getting a error as below. file_get_contents(): stream does not support seeking I installed simple_dom by a composer: composer require sunra/php-simple-html-dom-parser and used this too: use Sunra\PhpSimple\HtmlDomParser; This is my code:…
user10378098
1
vote
1 answer

Problem with SimpleDOM and sortedXPath

i have this XML structure: alb_1.xml 15 albthumbs/albth_1.jpg
Delizard
  • 11
  • 2
1
vote
0 answers

Modify DOM and replace mail addresses

I would like to make use of Simple HTML DOM parser to search for mail-adresses in the content of a html-site and replace them. The replacement contains a span element and a little bit JS (this should obfuscate the addresses. At the moment this works…
SPQRInc
  • 162
  • 4
  • 23
  • 64
1
2 3 4 5 6