如何从其他网站获取标题并将其显示在我的网站上 [英] How to get title from other websites and display it on my website
问题描述
您好!我正在创建一个网站,允许人们查看网站,以检查潜在的黑客攻击,诈骗等(链接: [DELETED] .com )。我想获得其他网站的标题< title>并将其显示在我的网站上。我该怎么做?
删除链接以防止发送垃圾邮件,意外与否。[/ edit]
我尝试过的事情:
尝试:
<?php
$ websiteurlname ='https://www.example.com';
echo $ websiteurlname;
?> Echoedhttps:// www .example.com
没用!请帮助
Hello! I am creating a website that allows people to review websites to check for potential hacking, scamming, etc (Link: [DELETED].com). I am trying to get the title of the other websites <title> and display it on my website. How would I do this?
[edit]Links deleted to prevent spamming, accidental or not.[/edit]
What I have tried:
Tried:
<?php
$websiteurlname = 'https://www.example.com';
echo $websiteurlname;
?>Echoed "https://www.example.com"
didn't work! Please help
推荐答案
websiteurlname ='https://www.example.com';
echo
websiteurlname = 'https://www.example.com';
echo
websiteurlname;
?> Echoedhttps://www.example.com
不起作用!请帮助
websiteurlname;
?>Echoed "https://www.example.com"
didn't work! Please help
它确实有效;它完全按照你的要求去做。但是,为了获得标题,您需要打开网站页面并从HTML中提取标题。请参阅 php阅读网页 - Google搜索 [ ^ ]。
It did work; it did exactly what you told it to do. However, in order to get the title you need to open the page of the website and extract the title from the HTML. See php read webpage - Google Search[^].
这篇关于如何从其他网站获取标题并将其显示在我的网站上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!