簡體   English   中英

如何將PHP頁面添加到blogspot.com新頁面

[英]How to add a PHP page into blogspot.com new page

我有一個真實的.php頁面,如http://hiteachers.com/soccer_parse.php?id=5 我想將它添加到blogger.com新頁面(**不是新的博客文章,或新的HTML小部件**,我已經成功了。

https://tranbongda.blogspot.com/p/function-myfunction-window.html

我使用這樣的代碼:

<script> 
  var Window; 
  // Function that open the new Window 
  function windowOpen() { 
      Window = window.open("http://hiteachers.com/soccer_parse.php?id=5", 
                             "_blank", "width=400, height=450"); 
  } 
  // function that Closes the open Window 
      function windowClose() { 
            Window.close(); 
   } 
 </script> 
<button onclick="windowOpen()">Open page</button> 
    <button onclick="windowClose()">Close page</button> 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script>
  $(document).ready(function()
  $("button").click(function(){
    $("#div1").load("http://hiteachers.com/soccer_parse.php?id=5");
  });
});
</script>

我的期望是,當訪問者訪問blogger.com頁面時,我希望blogger page立即加載.php page的原始內容( https://tranbongda.blogspot.com/p/function-myfunction-window.html )沒有點擊任何按鈕。

我曾想過用這個創建iframe:

<iframe name="Framename" src="http://hiteachers.com/soccer_parse.php?id=5" width="550" height="550" frameborder="0" scrolling="yes" style="width: 100%;"> </iframe>

但是blogger.com頁面不接受它,並返回如下錯誤消息: This page contains HTTP resources which may cause mixed content affecting security and user experience if blog is viewed over HTTPS.

然后我移動嘗試這個<object width="500" height="300" type="text/html" data="http://hiteachers.com/soccer_parse.php?id=5"></object> as根據一些博主的建議,但我仍然失敗了。

其他一些博客建議使用AJAX,這對我來說是一個新手。

那么,有沒有辦法解析provided .php page content並將其添加到blogspot.com/blogger.com new page而不顯示.php頁面或窗口彈出窗口的URL?

你能幫我嗎?

謝謝

正如博主可能已經建議的那樣,使PHP服務器成為REST端點,並使用異步JavaScript和XML訪問博客站點上的數據。 雖然今天人們傾向於划分XML部分並使用JSON或其他東西。 AJAX是通過使用XMLHttpRequest對象完成的。 Mozilla的規范提供鏈接和內容,它將向您展示如何使用它w3schools是一個很好的資源。

然后,這一切都歸結為直接編輯頁面

element.removeChild(element.lastChild);
element.appendAdjacentHTML('beforeend',xhr.responseText);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM