Javascript 如何获取<;表>;来自网站的标签

Javascript 如何获取<;表>;来自网站的标签,javascript,php,html,Javascript,Php,Html,我使用此代码获取网站页面的所有内容 $url = file_get_contents('https://berojgarjobs.com/forms/AirForceAFCAT.php'); echo $url; 这段代码显示了网站的所有内容,但我只想要那些内容 它位于标记内。 您可以使用javascript、php、curlany从任何网站获取标签中的特定内容 如果可以,建议答案?您可以使用PHP: 然后从该对象获取表节点。您可以使用preg\u match\u all函数: $url =

我使用此代码获取网站页面的所有内容

$url = file_get_contents('https://berojgarjobs.com/forms/AirForceAFCAT.php');  echo $url;
这段代码显示了网站的所有内容,但我只想要那些内容 它位于
标记内。 您可以使用javascriptphpcurlany从任何网站获取标签中的特定内容

如果可以,建议答案?

您可以使用PHP:


然后从该对象获取表节点。

您可以使用
preg\u match\u all
函数:

$url = file_get_contents('https://berojgarjobs.com/forms/AirForceAFCAT.php');
$pattern = "/<table(.*)<\/table>/i";
preg_match_all($pattern, $url, $match);
$table = $match[0][0];
echo $table;
$url=file\u get\u contents('https://berojgarjobs.com/forms/AirForceAFCAT.php');

$pattern=“/Try it by yourself,我们不会为您编写代码这对$url=file\u get\u contents(')不起作用;$pattern=”/
$url = file_get_contents('https://berojgarjobs.com/forms/AirForceAFCAT.php');
$pattern = "/<table(.*)<\/table>/i";
preg_match_all($pattern, $url, $match);
$table = $match[0][0];
echo $table;
$url = file_get_contents('https://www.sarkariexam.com/canara-bank-recruitment-2012/994');
$tables = [];
$pos = 0;
do {
    $start = strpos($url, '<table', $pos);
    $end = strpos($url, '</table', $pos);
    if ($end !== false && $start !== false) {
        $tables[] = substr($url, $start, $end - $start + 8);
        $pos = $end;
    }
} while ($end !== false && $start !== false);