Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 PHP Simple HTML DOM Parser 中添加用户代理,这样它就会使用每个用户代理浏览一个网站,为每个访问者提供他/她的 ip 地址。任何例子或想法..谢谢
您可以在流上下文的选项中设置用户代理
<?php $opts = array( 'http' => array( 'user_agent' => 'Enter agent here', ) ); $context = stream_context_create($opts); libxml_set_streams_context($context); $doc = DOMDocument::load('URL');
?>