2012-08-13 122 views
0

我需要帮助whit cURL和DOMdocument。 如何获取隐藏的输入元素的值?因为价值是可变的我不能选择价值白色卷曲!? 这样的形式:cURL和DOM文档

<form action=​"test.php" method=​"post">​ 
<input type=​"submit" value=​"Doorgaan">​ 
<input type=​"hidden" name=​"q" value=​"07ojc71sie1ysxikw4kvn5i3eb5nw6exd3gpahisvjqoh99ddt9">​ 
</form>​ 

有人可以帮助我吗?

在此先感谢! 问候,

约迪凡营

回答

0

使用cURL与的XPath的。这将只显示HTML元素“输入”与“隐藏”属性

shell~> curl http://example.org/ | xmllint --html --xpath "//input[@type='hidden']" - 

要通过拉回到的物品的价值,使用,或者

shell~> curl http://example.org/ | \ 
     xmllint --html --xpath "//input[@type='hidden']" - | \ 
     sed 's/.*value="\(.*\)".*/\1/'