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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:59:08+00:00 2026-06-09T06:59:08+00:00

i am using cURL to ping an API which results in HTML table. I

  • 0

i am using cURL to ping an API which results in HTML table. I am only looking to return the single numberic value of a field called “errorCode”.

(I’m using Jquery to ajax my Curl.php page, which pings an API which will echo to the curl page, and thus return the number back to my Jquery upon success. lol yeah).

Most of it works, except i cannot seem to parse the HTML to get the ONLY field i need. I wish it was XMl, but it isnt.

Should i use Regex to find the field and pull its value? another way?

Bottom of my CURL page, which outputs all the HTML. I just need to extract the Value of the hidden field called “errorCode”, and echo to page.

    $retValue = curl_exec($ch);                             
    echo $retValue;

$retValue currently prints the entire page, with HTML tags, table tags, etc.

Thanks

  • 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-09T06:59:11+00:00Added an answer on June 9, 2026 at 6:59 am

    Use DOMDocument and DOMXPath

    $dom = new DOMDocument();
    $dom->loadHTML($retValue);
    $path = new DOMXPath($dom);
    $item = $path->query('/table/tr/td[errorCode]');//whatever the xpath is
    $value = $item->item(0)->textContext;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using curl library which returns data to me through a callback function
I'm using cURL to get the XML file for my Twitter friend's timeline. (API
I'm using curl to login tumblr for some operations. I'm not using tumblr api
I'm using cURL to return data from external sites. How can I return the
I'm using cURL to scrape web pages but I can only seem to scrape
I am using CURL for get response from an web api. I am getting
I'm using cURL in my PHP app to connect to a RESTful API. However,
I'm using cUrl to POST to a web page (not local) and then return
I'm currently using curl to login to a site and grab the html for
I am using curl to get a json file which can be located here:

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.