我想在我的网站上列出精选网站,我认为尊重和使用他们的网站很酷.如何从域中获取JSP或XSLT中的任意URL?我可以启动PHP或javascript,但XSLT是首选的方法.
nLL*_*nLL 63
你也可以这么做
http://s2.googleusercontent.com/s2/favicons?domain_url=http://domain.com
Dan*_*llo 26
要获取网站的图标,您需要加载每个特色网站的索引HTML并检查以下任一项:
HTML:
<link rel="icon" type="image/vnd.microsoft.icon" href="http://example.com/image.ico">
<link rel="icon" type="image/png" href="http://example.com/image.png">
<link rel="icon" type="image/gif" href="http://example.com/image.gif">
Run Code Online (Sandbox Code Playgroud)
XHTML:
<link rel="icon" type="image/vnd.microsoft.icon" href="/somepath/image.ico" />
<link rel="icon" type="image/png" href="/somepath/image.png" />
<link rel="icon" type="image/gif" href="/somepath/image.gif" />
Run Code Online (Sandbox Code Playgroud)
Internet Explorer可能使用稍微不同的格式:
<link rel="SHORTCUT ICON" href="http://www.example.com/myicon.ico" />
Run Code Online (Sandbox Code Playgroud)
另请注意,由于大多数Web浏览器不需要HTML链接来检索favicon,因此favicon.ico
如果找不到上述链接引用,还应检查网站的文档根目录.
使用PHP,可以通过以下方式轻松获取网页的HTML内容file_get_contents($url)
:
$url = 'http://www.exmaple.com';
$output = file_get_contents($url);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
40564 次 |
最近记录: |