从外部第三方网页嵌入<div> </div>

时间:2014-07-18 16:29:37

标签: html css

我试图在我的网页中显示包含texbox和按钮的div。

div不在我的服务器中,是第三方网站,我无法修改基本代码。

这是可能的???这是我想在我的网站上显示的代码,来自第三方网站。

div标签ID为&#34; body&#34;

<div id="body"> 
        <h2>Consulta de Teléfonos Robados o Bloqueados por IMEI</h2><div style="width:100%; height:auto;">
<script type="text/javascript">
function buscar(keyWords){
jQuery(document).ready(function($){
    $.post('../../../bdtronline/sistema/areas.php',{
    accion:'searchImei',
    keyWords:keyWords},
    function(data){$('#listImeiFound').html(data);});
});
}
</script>
<form>
Buscar <input type="text" id="keyWords" name="keyWords" size="50" /><input type="button" value="buscar" onclick="buscar(document.getElementById('keyWords').value);"     />
</form>
</body>

1 个答案:

答案 0 :(得分:0)

如果您在运行JavaScript的服务器上运行PHP,则可以加载服​​务器的页面,该页面通过PHP从其他域获取页面内容:

proxy.php

<?php
$opts = array('http' =>
  array(
    'method'  => 'POST',
    'header'  => "Content-Type: application/x-www-form-urlencoded",
    'content' => http_build_query($_POST)
  )
);
$context = stream_context_create($opts);
echo file_get_contents('http://php.net/manual/en/function.file-get-contents.php', false, $context);

yoursite.html

// ...
jQuery(document).ready(function($){
    $.post('proxy.php',{
      accion:'searchImei',
      keyWords:keyWords},
      function(data){$('#listImeiFound').html(data);});
    });
});
// ...
相关问题