admin管理员组文章数量:1321245
Is there a way to disable Javascript in a Curl request in PHP ?
Trying to mimic a browser request (from a browser with Javascript disabled)
Could this be done via a header/user agent/cookie ?
Thanks.
Is there a way to disable Javascript in a Curl request in PHP ?
Trying to mimic a browser request (from a browser with Javascript disabled)
Could this be done via a header/user agent/cookie ?
Thanks.
Share Improve this question asked Dec 11, 2011 at 10:54 Simon GelfandSimon Gelfand 612 silver badges3 bronze badges 4- 3 This doesn't make sense. curl doesn't know about/care about/understand JavaScript: see Does curl support JavaScript? If you want to make sure the UA/other headers align, then use a tool like Fiddler2 to see what (your) "normal browser" sends, and then read the curl documentation for how to send it "exactly like the browser". – user166390 Commented Dec 11, 2011 at 10:55
- 1 cURL doesn't look at javascript at all. To cURL, the entire page is just a blob of text, so whether it has only html, javascript, xml, or anything else, curl will behave the same – pho Commented Dec 11, 2011 at 11:06
-
2
If you mean that you are using cURL as sort of a proxy, where it requests a page, and then outputs it as-is, then you need to remove all
<script></script>
tags, and anything between them, before it is outputted. – Shea Commented Dec 11, 2011 at 11:14 - no... he means when the target URL removes content with jabascript until the user interacts somehow and triggers the content. however, when javascript is disabled in the browser, the content is delivered normally. i have experienced this occasionally -- for example, clicking a "i am over 18 years old" button on a vaping website... or any age-restricted website. pinterest is another example. so, it is not related to whether cURL processes javascript -- but rather how cURL will NOT react to javascript needed to render the content. – aequalsb Commented Nov 29, 2016 at 4:49
1 Answer
Reset to default 7Is there a way to disable Javascript in a Curl request in PHP ?
Yes, there is: Simply leave everything as it is. :)
Curl will not interpret Javascript. Actually, the big challenge is to build automated, curl-based clients that do interpret Javascript.
本文标签: Disable Javascript in Curl Request (PHP)Stack Overflow
版权声明:本文标题:Disable Javascript in Curl Request (PHP) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742032532a2416717.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论