Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/275.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 修改a<;部门>;带旋度的元素_Php_Javascript_Html_Curl - Fatal编程技术网

Php 修改a<;部门>;带旋度的元素

Php 修改a<;部门>;带旋度的元素,php,javascript,html,curl,Php,Javascript,Html,Curl,我知道如何使用CURL_setopt函数提供或修改字段,以及如何使用cookie,但我找不到的是如何使用CURL修改HTML元素 例如,假设我想替换下面代码中的函数“submit\u device\u form” <div id="bottombuttons"> <table border="0" cellspacing="0" cellpadding="0" style="width:100%;"> <!-- buttons --> <

我知道如何使用CURL_setopt函数提供或修改字段,以及如何使用cookie,但我找不到的是如何使用CURL修改HTML元素

例如,假设我想替换下面代码中的函数“submit\u device\u form”

<div id="bottombuttons">
  <table border="0" cellspacing="0" cellpadding="0" style="width:100%;">
  <!-- buttons -->
    <tr>
      <td>&nbsp;</td>
      <td class="separatorButton">
      <table border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><a href="#" onclick="javascript:submit_device_form(); return false;" class="buttonLink100">Set</a></td>
          <td><a href="#" onclick="javascript:cancel_device_form(); return false;" class="buttonLink100">Cancel</a></td>
        </tr>
      </table>
      </td>
    </tr>
  <!-- fixes the width of the first column -->
    <tr>
      <td style="padding:0;"><img src="images/spacer.gif" alt="" width="200" height="1" border="0" ></td>
      <td style="padding:0;"><img src="images/spacer.gif" alt="" width="360" height="1" border="0" ></td>
    </tr>
  </table>
</div> 

通过“提交我的表单”,我的PHP脚本中包含了一个新的JavaScript函数。我会怎么做

我研究了“PHP Simple HTML DOM Parser”库,因为它提供了setAttribute和removeAttribute函数,这使我能够轻松地完成这项工作,但随后我错过了有关如何让它访问页面read wia CURL的信息,因此我陷入了困境

谢谢你的帮助


Robert

为什么不只使用str_ureplace?这是我对PHP DOM函数的同样问题:就我所了解到的,我可以通过CURL函数“仅”访问HTML页面。根据您的问题,我理解,您需要从代码中删除“submit\u device_uform()”,使用preg\u replace$result=preg\u replace(“/submit_device_form()/”,“”,$html);@Nishu-是的,这是我想要完成的替换操作。我知道当我发出curl_exec()函数时,我会得到html页面的“副本”。但那只是“副本”,对吗?那么“实际副本”在哪里呢“佩奇,因为据我所知,这是我必须修改的。我不确定我是否正确理解了你的问题。但是如果您试图通过curl修改原始页面。这是不可能的。