Extract content of specific div class php dom

Extract content of specific div class php dom

Content Index :

Extract content of specific div class php dom
Tag : php , By : PepeM
Date : November 29 2020, 04:01 AM

To fix the issue you can do You are getting all those errors because the HTML that you are trying to parse is invalid i.e. it is missing required tags, etc.
<script type="text/template" id="tracking-loading-tpl">
    <%for(var i = 0,len = arrTrackNums.length; i < len; i++){%>
        <div class="tracklist-item tracklist-tracking"
            <div class="tracklist-fill">
                <div class="tracklist-ps-transit"> <%==packageStatus[i]%></div>
                <div class="yqcr-loading-list"> <%==loading%></div>
            <div class="tracklist-da">
                <div class="gad-container" id="DA_V6-Extcall-Track"></div>
$page = file_get_contents('https://extcall.17track.net/en/track#apitype=1&nums=RK444760227FR');

$config = array(
    'output-html' => 'yes',
    'clean' => 'yes',
$tidy = tidy_parse_string($html, $config, 'utf8');

$doc = new DOMDocument();
$divs = $doc->getElementsByTagName('div');
foreach($divs as $div) {
    // Loop through the DIVs looking for one withan id of "content"
    // Then echo out its contents (pardon the pun)
    if ($div->getAttribute('class') === 'tracklist-fill') {
         echo $div->nodeValue;

No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

How can I extract content of a specific div from a webpage?

Tag : php , By : Erik
Date : March 29 2020, 07:55 AM
Hope that helps I want to load content of a specific div with class='box' from a webpage, and I used Simple HTML DOM for this. but I can't write a clear pattern for preg_match, here is my php code: , SimpleHtmlDOM :
$html = new simple_html_dom();

// Load from a string
$html->load('<html><body><p>Hello World!</p><p>We're here</p></body></html>');

// Load a file

# get an element representing the second paragraph  
$element = $html->find("div[class=box1]");

#access HTML attr
$element->innertext .= "Somthing";

#save and echo
echo $element->save();

Extract specific text within content

Tag : regex , By : KT.
Date : March 29 2020, 07:55 AM
around this issue I am working on email content which is dumped as dataframe value in row , and this has to be separated as different based on starting from: untill till next from: , You could use strsplit fucntion.
> strsplit(gsub("(?s)^_+\\s+", "", x, perl=T) , "_+\\s*(?=From:)", perl=T)[[1]]
[1] "From:   Kumar M,  \nSent:   Tuesday, 21 October 2014 7:30 AM\nTo: Deo, Ravinesh; G S, Venkatesh;\nCc: Monteleone, Elif; Kabyanga, Isaac\nSubject:    FW: Please Approve the Qlik  Access.\n\n\nHi Ravi,\n\nWe will work on the providing David access to Ql and an email will be sent out once the access is set up.   \n\nRegards,\nSanthosh\n\n"
[2] "From:   Deo, Ravinesh  \nSent:   Tuesday, 21 October 2014 7:20 AM\nTo: Kabyanga, Isaac; Kumar M, Santhosh\nCc: Monteleone, Elif\nSubject:    FW: Please Approve the Qlikview Access.\n\nHi Isaac/Santhosh,\n\nAppreciate if you can grant access to David Dennis for GPA – Timor.\n\nDavid is CEO Timor Leste.\n\nThanks\nRavi\n\n"               
[3] "From: Dennis, David (Timor) \nSent: Tuesday, 21 October 2014 11:34 AM\nTo: Deo, Ravinesh\nSubject: FW: Please Approve the Q GPA Access.\n\nHere you go - appreciate your help Rgds\n\n"                                                                                                                                                           
[4] "From:   Dennis, David (Timor)  \nSent:   Thursday, 9 October 2014 11:33 AM\nTo: Buchanan, Geoffrey (Solomon Islands)\nSubject:    Please Approve the Qlikview Access.\n\nHello,\n\nCan you please review the attached form and click ' Manager Approval' to approve.\n\nThanks"

(Imacross) Extract Text from _Xpath_ no extract content from Class under Javascript

Tag : javascript , By : msg
Date : March 29 2020, 07:55 AM
hop of those help? Using this code under imacros 9.0.3 running on Firefox 55 works very well extracting the text from the class , Hope the following script should work:
var macro;
macro = "CODE:";

macro += 'TAG XPATH="//div[contains(@class,\'col-md-12 text-center alert alert-danger\')]" EXTRACT=TXT' + "\n";


How can I quickly extract rows based on content in a specific content in a fixed width text file using command line tool

Tag : development , By : Ram
Date : March 29 2020, 07:55 AM

How to extract specific content using pandas

Tag : python , By : haver
Date : March 29 2020, 07:55 AM
may help you . Consider the following data , Considering the value always lie between LiPo and mAh, use extract:
df = pd.DataFrame({'col': ['Non-removable Li-Po 2870 mAh battery',
                           'Non-removable Li-Po 5910 mAh battery (A3-A20-K1AY)',
                           'Non-removable Li-Po 1810 mAh battery (6.9 Wh)']})
df.col.str.extract('Li-Po (.*) mAh')

0  2870
1  5910
2  1810
Related Posts Related QUESTIONS :
  • Codeigniter: Models not working with an error: Undefined property: CI_Loader
  • How to use + or - operators as parameters in Doctrine prepared SQL statement?
  • How to run scrapy with url parameters from php on linux debian
  • Preg matching imgur.com links
  • Php - Code comparing value of database to the value send by android app
  • Laravel pagination object in javascript
  • Error in validating message of no votes PHP
  • Symfony site on Azure with ClearDB connection
  • Woocommerce upsell with checkboxes
  • How to login/logout with Hybridauth 3?
  • Convert INT number in PHP
  • php/mysql. selecting 2 common fields in 2 tables
  • Expand an string based on values in an array in PHP
  • When you absolutely have to manually escape SQL in CakePHP 3.4.7
  • Htaccess redirecting wrong page
  • Laravel Optional WHERE clause
  • PHP unpack overlfow variable memory limit
  • How to check the URL's structure using PHP preg_match?
  • PHP preg_replace - text will not be recognized
  • Show image from other domain without showing the domain name - PHP
  • How to run and watch local server at the same time?
  • Access form request from Observer laravel
  • single quote problem with preg_replace_callback
  • How to Create A Unique URL for each product enquiry form for Google Analytics Tracking
  • Laravel email configuration: what am I missing?
  • Assign indexed array values to multidimensional array?
  • Custom WordPress stylesheet not loading
  • Data attribute only returning first value
  • How to list all roles with Permissions,in spatie permission Package?
  • How to achieve this number pattern with n input
  • How to iterate array inside array data in laravel ,output are given below
  • To get output of movie with its genre
  • Extracting some data from a JS object literal string in PHP using Regex
  • axios and vuex are deleting wrong index in array
  • Setting empty CURLOPT_POSTFIELDS
  • Laravel 5.8 use subdomain as API endpoint beside domain.com/api
  • Error while add data in database SQL Server 2016
  • Does PhpStorm allow to skip PHPDoc tags when type hints is declared?
  • html classes are changed to Attributes
  • Using json to import multidimensional data
  • passing data from the view to the controller, where the data comes from another controller
  • How to extract integer and decimal numbers in PHP string correctly?
  • Parsing Sub-Object from an XML Feed with objects
  • Getting error "Unknown column 'text' in 'field list'"
  • How to properly get onedrive access token via php and curl
  • How to add spell check to a php function
  • Is it posible to create css rules with php?
  • Pretty URL with $_GET method
  • Wordpress always load same page - index.php
  • Find value in array and return with new from different array
  • PHP multiple file upload with different keys
  • Can't modify times one a time without weird errors
  • Get size of scraped image with domcrawler (Goutte)
  • Laravel - Ordering a collection of models
  • PHP Fatal error: Uncaught Error: Call to a member function setFetchMode() on boolean
  • Strict Standards: Only variables should be passed by reference in /main_dir/sub_dir/backup.php
  • Uncaught Google_Exception: (update) unknown parameter: 'copyRequiresWriterPermission'
  • Laravel 5 form does not redirect with old input
  • How to get values greater than or equal to in Mysql database sql when its a value like 1:00 PM?
  • PHP datediff overday issue
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com