我正在网站中构建字典。我将这些术语的原始网站(www.rae.es)定义称为“自己的CSS”。这里是代码:重定向两次到网站
<?php
$word = $_REQUEST['word'];
$url = "http://lema.rae.es/drae/srv/search?val={$word}";
$css = <<<EOT
<style type="text/css">
@font-face {
font-family: 'brannboll_fetregular';
src: url('brannbollfet-webfont.eot');
src: url('brannbollfet-webfont.eot?#iefix') format('embedded-opentype'),
url('brannbollfet-webfont.woff') format('woff'),
url('brannbollfet-webfont.ttf') format('truetype'),
url('brannbollfet-webfont.svg#brannboll_fetregular') format('svg');
}
.a
{
color: #ffe200;
margin-top:20px !important;
}
.f
{
margin-left:20px !important;
margin-top:10px;
font-size: 200%;
color: #ffe200;
font-family: 'brannboll_fetregular';
}
.o
{
font-size: 80%;
color: #ffe200;
margin-left:10px;
font-family: 'Belgrano', serif;
}
.q {
margin-left:10px;
font-family: 'Belgrano', serif;
}
.k {
margin-left:10px;
font-family: 'Belgrano', serif;
}
.p {
font-family: 'Belgrano', serif;
}
img
{
visibility:hidden;
}
</style>
EOT;
$data = file_get_contents($url);
$data = str_replace('<head>', $css.'</head>', $data);
$data = str_replace('<span class="f"><b>.</b></span>', '', $data);
echo '<div id="result1"
style="
top: 77%;
left: 55%;
overflow:scroll;
width:400px;
height:300px;
border: 1px solid #000000;
border-radius: 15px;
background-opacity: 0.5;
background: #047C8F;
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
box-shadow: inset 0px 3px 13px #000000;
-moz-box-shadow:
0px 3px 13px rgba(000,000,000,0.5),
inset 0px 0px 13px rgba(0,0,0,1);
-webkit-box-shadow:
0px 3px 13px rgba(000,000,000,0.5),
inset 0px 0px 13px rgba(0,0,0,1);
">
'.$data.'
</div>';
?>
现在,有时,对于某些单词,建议出现了。例如:http://lema.rae.es/drae/?val=casa。如果你搜索“casa”,你会想出3条建议。现在,如果在我的网站上,我点击这些超链接,我被重定向到一个错误页面。所以,我现在认为解决方案是在PHP的手中,我只是不知道从哪里开始。 谢谢!
1)如何“修复”扫描的链接。 2)只要我不赚钱就合法合法 – j1nma
找到它们并用指向你的脚本的链接替换它们(然后应显示正确的答案) –