Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8101715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:03:10+00:00 2026-06-05T23:03:10+00:00

Help please on how to extract data like 15,Teaching Periods 1 and 2.,Max 150.

  • 0

Help please on how to extract data like 15,Teaching Periods 1 and 2.,Max 150. e.t.c from the sample html code below using DOMDocument function? I have tried to work around it but having mutiple tags before the text I like to extract makes it harder for me to extract all the content once as I have to save all the extracted data into mysql database.

<P><SPAN STYLE="font-size: 16pt; font-weight: bold"><a name="CS1050"class="modtitle">CS1050 Fundamentals of Internet Computing</a></SPAN></p>
<P><B>Credit Weighting: </B>15<BR><BR>
<B>Teaching Period(s): </B>Teaching Periods 1 and 2.<BR><BR>
<B>No. of Students: </B>Max 150.<BR><BR>
<B>Pre-requisite(s): </B>None<BR><BR>
<B>Co-requisite(s): </B>None<BR><BR>
<B>Teaching Methods: </B>72 x 1hr(s) Lectures; 18 x 2hr(s) Practicals.<BR><BR>
<B>Module Co-ordinator: </B>Professor Gregory Provan, Department of Computer Science.     <BR><BR>
<B>Lecturer(s): </B> Mr Gavin Russell, Department of Computer Science.<BR><BR>
<B>Module Objective: </B>To introduce students to Internet computer systems, web design, and<BR>client-side programming.<BR><BR>
<B>Module Content: </B>This module provides an introduction to the key concepts of Internet computing. Starting with the fundamentals of computer systems and the Internet, students progress to learn how to design web sites and how to utilize simple client-side programming. Issues related to user interface design and human-computer interfacing (HCI) are covered. Broader issues related to the use of the Internet for Blogging and Social Networks are discussed. The practical element of the module allows students to develop skills necessary for web site design using simple client side programming.<BR><BR>
<B>Learning Outcomes: </B>On successful completion of this module, students should be able to:<BR>&middot; Understand the fundamental principles of computer systems and the Internet;<BR>&middot; Design web sites;<BR>&middot; Use simple client-side programming;<BR>&middot; Understand the principles of user interface design and human-computer interfaces.<BR><BR>
<B>Assessment: </B>Total Marks 300: End of Year Written Examination 240 marks; Continuous Assessment 60 marks (Departmental Tests; Assignments).<BR><BR>
<B>Compulsory Elements: </B>End of Year Written Examination; Continuous Assessment.<BR<BR>
<B>Penalties (for late submission of Course/Project Work etc.): </B>Work which is submitted late shall be assigned a mark of zero (or a Fail Judgement in the case of Pass/Fail modules).<BR><BR>
<B>Pass Standard and any Special Requirements for Passing Module: </B>40%.<BR><BR>
<B>End of Year Written Examination Profile: </B>1 x 3 hr(s) paper(s).<BR><BR>
<B>Requirements for Supplemental Examination: </B>1 x 3 hr(s) paper(s) to be taken in Autumn. The mark for Continuous Assessment is carried forward.</P>



                   MY SAMPLE CURL CODE

$content3= $dom->getElementsByTagname('p');
$content4 = $dom->getElementsByTagname('b');

        //===========================================
        //=====  EXTRACT P STUFF ====================
        //===========================================

        foreach ($content3 as $value) {
            $contentnew[]= $value;
        print_r($value); 


        echo "Attribute Value = ";
        echo $value->getAttribute('value');
        echo "<br />";


        // let's get hold of the text value from the node
        $mytempvariable=$value->nodeValue;
        print "CONTENT OF P NODE: \n\n$mytempvariable <br /> <br />\n\n\n";
        }
        echo "<br /> <br /> <br />";



        //===========================================
        //===== EXTRACT B STUFF =====================
        //===========================================
        foreach ($content4 as $value) {
            $contentnew[]= $value;


        echo "Attribute Value = ";
        echo $value->getAttribute('value');
        echo "<br />";

        print_r($value); 
        // let's get hold of the text value from the node
        $mytempvariable=$value->nodeValue;
        print "CONTENT OF B NODE: \n\n$mytempvariable <br /> <br />\n\n\n";
        }
        echo "<br /> <br /> <br />";

I heard I could use ->nextSibling or xpath to extract all the data after all the b nodes but I cant seems to get around using xpath to extract all the relevant data I need.I could I do this please ??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T23:03:11+00:00Added an answer on June 5, 2026 at 11:03 pm

    You were very close:

    $result = array();
    foreach($dom->getElementsByTagName('b') as $node){
        $result[preg_replace('/:\s+$/','',$node->textContent)] = trim($node->nextSibling->textContent);
    }
    var_dump($result);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below is the code i use to extract data from a table to a
Can you please help us to extract word from a sentence like: He's led
Would someone please help me. I have a stored procedure (see below) for data
I am trying to extract data from a string using Regex in VB.net. This
i have some problem to extract some data from html source. following is sniffit
I have this html data which I need to parse to extract data from
Help me please. How to setup this rewrite for nginx 1.0.14? RewriteRule ^([^/]*)\.html$ /?page=$1
Please help me with using the DrScheme built-in function filter. create a function hello
Please help! I need to produce a Crystal Report with multiple data columns, but
I want to extract data from a word document with extension docx. This document

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.