$doc = new DOMDocument();
$doc->loadHTML($source);
$xpath = new DOMXpath($doc);
//$rowxpath = $post->xpath;
$rowxpath = '//*[@class="s-lg-az-result s-lg-az-result-new"]';
$elementsn = $xpath->query($rowxpath);
In the above, $elementsn->length is not 0. But when
$rowxpath = '//*[@class="s-lg-az-result"] | //*[@class="s-lg-az-result s-lg-az-result-new"]';
it's always 0. The path doesn't seem to work when the | character is used.
How come, and how can I solve this?
NOTE: for what I used for $source, please see https://can-la.com/samplesforstackexc/test3.html.
Also note: if you are going to file_get_contents('https://can-la.com/samplesforstackexc/test3.html'); this would produce some errors related to SSL:
Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /Users/user/HoldingForDO/libTOdatabases/index.php on line 48
Warning: file_get_contents(): Failed to enable crypto in /Users/user/HoldingForDO/libTOdatabases/index.php on line 48
Warning: file_get_contents(https://can-la.com/samplesforstackexc/test3.html): failed to open stream: operation failed in /Users/user/HoldingForDO/libTOdatabases/index.php on line 48
However, this is not the issue, as I am only uploading this file to can-la.com to serve as a sample for this question. Even if u download the file and file_get_contents('test3.html') directly, the problem still arises.