Skip to content

Commit

Permalink
new referal regex
Browse files Browse the repository at this point in the history
  • Loading branch information
padams committed Jan 24, 2022
1 parent 7e89e13 commit 148e49f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions owa_httpRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,25 @@ function __construct() {
* @param string $link
*/
function extract_anchor($link) {

$regex = '/<a\s[^>]*href\s*=\s*([\"\']??)(http|https[^\\1 >]*?)\\1[^>]*>s*(.*)<\/a>/simU';

if( preg_match_all("$regex", $this->getResponseBody(), $matches, PREG_SET_ORDER ) ) {

owa_coreAPI::debug( 'TEST Found anchor info: ' . print_r( $matches, true ) );

foreach($matches as $match) {
// $match[2] = link address
// $match[3] = link text

if (isset($match[3] && $link === $match[3] ) ) {
$this->anchor_info = array('anchor_tag' => match[0], 'anchor_text' => owa_lib::inputFilter($match[3]));
owa_coreAPI::debug('Anchor info: '.print_r($this->anchor_info, true));
}
}
}

return;

$matches = '';
$regex = '/<a[^>]*href=\"%s\"[^>]*>(.*?)<\/a>/i';
Expand Down

0 comments on commit 148e49f

Please sign in to comment.