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
Use
DOMDocumentandDOMXPath