You probably don't need the curl but this is how I would approach it.
$curl=curl_init( 'http://www.example.com/ABC' );
/* Set other curl options */
$response=curl_exec( $curl );
curl_close( $curl );
libxml_use_internal_errors( true );
$dom = new DOMDocument('1.0','utf-8');
$dom->validateOnParse=false;
$dom->standalone=true;
$dom->preserveWhiteSpace=true;
$dom->strictErrorChecking=false;
$dom->substituteEntities=false;
$dom->recover=true;
$dom->formatOutput=false;
$dom->loadHTML( mb_convert_encoding( $response, 'utf-8' ) );
$parse_errs=serialize( libxml_get_last_error() );
libxml_clear_errors();
/* there was a typo here - should be DOMXPath! */
$xpath=new DOMXPath( $dom );
$elements = $xpath->query("*/div[@id='myspanId']");