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 7829693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:52:54+00:00 2026-06-02T10:52:54+00:00

From gateway I get one very unsual result it’s HTML inside XML, which confuses

  • 0

From gateway I get one very unsual result it’s HTML inside XML, which confuses me. When I echo variable $result this is the output:

<Results>
    <XML_Report>
       <Subject>
         <EFX_Code>199</EFX_Code>
         <Referral>SPECIAL_WOHA</Referral>
       </Subject>
    </XML_Report>
<HTML_Report>
<![CDATA[
        <html>
        <head>


        </head>
        <body>



        <a name="mergereport" />

        <p>MERGE REPORT</p>

        <table border="1" WIDTH="100%" cellpadding=0 cellspacing=0>
        <tr><td class=heading colspan=4 align="center" bgcolor="#c0c0c0"><p class=heading>Personal Information Since 08/09/09 FAD 04/17/12</p></td></tr>
        <tr><td><br /></td><td><br /></td><td width="15%" align=center><p><b>Reported</b></p></td><td align=center><p><b>Bur</b></p></td></tr>
        <tr>
        <td width="15%" valign=top align=right><p class=pipad><b>
        Name<br />
        SSN<br />
        Inquiry SSN<br />
        DOB<br />
        Address
        </b></p></td>
        </tr></table>
        </body>

        </html>
]]>
 </HTML_Report>
</Results>

How can I parse that variable to extract out only part of HTML I want eg. anything withing tags inside with PHP… I’ve browsed a lot but can’t find any proper answer if such parsing is possible and more important HOW?

  • 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-02T10:52:56+00:00Added an answer on June 2, 2026 at 10:52 am

    A quick and dirty solution:

    //Assumes the contents of the xml file are in a string called $xml
    $arr = explode("<HTML_Report>", $xml);
    if(count($arr) > 1)
    {
        $arr2 = explode("</HTML_Report>", $arr[1]);
        $html_portion = $arr2[0];
    }
    

    Summary: split the xml string at the HTML_Report start and end tags, each time keeping only the element of the resulting array containing the HTML portion. This will result in $html_portion also containing the CDATA wrapper so if you want to avoid that then split on “”.

    It ain’t elegant but it gets the job done.

    EDIT: Fixed code from $xml[1] to $arr[1] – thanks Marc B.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a gateway to get a result set from my database. How
I get poorly formatted invoice-related email from my payment gateway. I want to automatically
I have powershell script which sends text message through a sms-gateway. I get the
I have a tun/tap device which is used to read incoming packets from one
I have a WizardStep Control from which i need one information: The total amount
I have an sms gateway which pushes me get-requests if a user replys an
From a WCF service we get a quit complex reponse with multiple nested lists
Scenario 1 This involves using one gateway route in app.yaml and then choosing the
I have a custom InjectionProvider which retrieves a User object from the SecurityContext and
Background: Every work day I get an e-mail from a vendor who sends me

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.