dqrl3595 2015-08-27 14:28
浏览 45


I made a function in php that returns the result of a POST and converts it to a string using cURL . However, my code returns a lot of useless information. I wanted to manipulate the string so that I could delete all the useless information and leave only what is useful, that is, delete everything that comes before the word </SCRIPT> in string.

I'm putting a piece of string that I get (there is a lot more information before that). I wanted my string was equal to that in the interval between <dt><b><font color="maroon">como</font></b> and </table>.

<SCRIPT LANGUAGE='JavaScript1.1'><!--
  var objForm = document.theform;
  var index = 0;
  objForm.text.value="como n\u00e3o amar uma pessoa t\u00e3o linda";

  checkIt(objForm.parser, 'parse');

  checkIt(objForm.visual, 'niceline');

function getIndex(elemID, testValue){
  for(i=0; i<elemID.length; i++){
    if (elemID[i].value == testValue)
      return i;
  return 0;

function checkIt(element, value) {
  if (element.length==1 || element.type=="checkbox"){
  else if (element.length>1){
    index = getIndex(element, value);
**<dt><b><font color="maroon">como</font></b>** 

<font color="maroon">[como]</font>  &lt;rel&gt; &lt;ks&gt; <font color="blue"><b>ADV</b> </font> <font color="darkgreen">@ADVL&gt;</font> <font color="darkgreen"><b>@#FS-ADVL</font></b> <font color="darkgreen"><b>@#FS-N&lt;</font></b>
<dt><b><font color="maroon">não</font></b> 

<font color="maroon">[não]</font>  <font color="blue"><b>ADV</b> </font> <font color="darkgreen">@ADVL&gt;</font>
<dt><b><font color="maroon">amar</font></b> 

<font color="maroon">[amar]</font>  &lt;vt&gt; <font color="blue"><b>V</b> FUT 1/3S SUBJ VFIN </font> <font color="darkgreen">@FMV</font>
<dt><b><font color="maroon">uma</font></b> 

<font color="maroon">[um]</font>  &lt;arti&gt; <font color="blue"><b>DET</b> F S </font> <font color="darkgreen">@&gt;N</font>
<dt><b><font color="maroon">pessoa</font></b> 

<font color="maroon">[pessoa]</font>  &lt;H&gt; <font color="blue"><b>N</b> F S </font> <font color="darkgreen">@&lt;ACC</font>
<dt><b><font color="maroon">tão</font></b> 

<font color="maroon">[tão]</font>  &lt;dem&gt; &lt;quant&gt; <font color="blue"><b>ADV</b> </font> <font color="darkgreen">@&gt;A</font>
<dt><b><font color="maroon">linda</font></b> 

<font color="maroon">[lindo]</font>  <font color="blue"><b>ADJ</b> F S </font> <font color="darkgreen">@N&lt;</font>
<dt><b><font color="maroon">.</font></b> 


<div style="text-align: center;">
<hr width="60%">
<b style="color: #800; font-size: 75%;">With the most recent Java update, Oracle has decided to set the default Java security settings to block all unsigned applets.
<br/>Until we can fix this on our end by signing the applets, you can lower your security settings from Control Panel -> Java -> Security and set the slider to Medium instead of High.
<br/>If something else isn't working properly, contact <a href="mailto:mail@tinodidriksen.com">Tino Didriksen</a>.</b>
<hr width="60%">
<a href="/visl/about/">Copyright 1996-2015</a>
| <a href="/contact.html">Report a Problem / Contact Us</a>
<!-- | <a href="http://beta.visl.sdu.dk/visl/about/spgskema_en.html" title="Please fill out our survey on how you use the VISL site!">Visitor Questionnaire</a> -->
| <a href="/visl/pt/parsing/automatic/parse.php?print=1" rel="nofollow">Printable Version</a>
<!--[if IE]>

What function I use to be able to manipulate this string and delete these useless information ?

  • 写回答

2条回答 默认 最新

  • duanhongqiong9460 2015-08-27 14:41

    You could use strpos to find the position of where you want to split the string. Then use substr to split the string from that position.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 请问如何查看手机root记录?
  • ¥15 商城小程序订单号重复
  • ¥15 学校优化算法sbo和蚁群算法怎么结合
  • ¥21 matlab怎么求时域信号的二阶导数
  • ¥15 判断两个表是否完全相同
  • ¥15 java map类型数据格式,如何快速通过前缀匹配元素
  • ¥15 stc12c5a60s2、QMC5883L、LCD1602组合测量磁场所需程序
  • ¥20 Win11测试yolov4,“找不到nvcuda.dll”怎么办?
  • ¥15 simulink绘制bode图
  • ¥15 php_network_getaddresses: getaddrinfo failed: Name or service not known