最短マッチやら難しく考えすぎず
なるべくシンプルにシンプルにー
まずは、file_get_contentsなどで取得した
htmlソースを$getContentに入れる。
// jsonldを抽出 preg_match_all('/<script[^>]*?type\s*=\s*"?\'?application\/ld\+json"?\'?[^"\']+.*?<\/script>/is', $getContent, $matchScript); // aタグ抽出して、hrefの中身も取得 preg_match_all('/<a[^>]*?href\s*=\s*"?\'?([^"\']+).*?<\/a>/is', $getContent, $matchAtags);
コメント