Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
359 views
in Technique[技术] by (71.8m points)

php - 我想使用php来使用简单的html dom抓取输入值readonly值,我一直得到空白的回报(I want to use php to scrape the input value readonly value using simple html dom, I keep getting a blank return)

I would like to scrape the readonly value from the following code below inside this input form, I am using php with simple html dom but I keep getting a blank reply.

(我想在此输入表单内的以下代码中抓取只读值,我使用的是带有简单html dom的php,但我一直收到空白回复。)

what can I do to make it give me that value.

(我该怎么做才能使其具有我的价值。)

<input id="copy-video-embed" type="text" readonly value="<iframe src=&quot;https://www.example.com/embedframe/52285029&quot; frameborder=0 width=510 height=400 scrolling=no allowfullscreen=allowfullscreen></iframe>" class="form-control">

so I have tried to the code below but does not seem to work

(所以我尝试了下面的代码,但似乎不起作用)

$node = $stuff->find('input[type=text]' , 0)->plaintext ;  print_r($node) ;
  ask by user1951739 translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

When you use find to get a part of your HTML you get the attributes as class variable so you can use href or value to get the value.

(当您使用find获取HTML的一部分时,会将属性作为类变量获取,因此您可以使用hrefvalue来获取值。)

$node = $stuff->find('input[type=text]' , 0)->value;

something like this.

(这样的事情。)

https://simplehtmldom.sourceforge.io/manual.htm

(https://simplehtmldom.sourceforge.io/manual.htm)

Here are some good examples.

(这里有一些很好的例子。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...