admin管理员组文章数量:1356901
I'm using CURL to extract some real estate listings. But, recently, a website changed his way to municate the phone number: The visitor must click on a "Show the phone number" link that returns the result in jSon. I found these information with Firebug:
.json?Id=023DSFS
And for the linkn the code source is (obiously):
<a href="#" class="showDetail">Show the phone number</a>
So, how can I simulate a click and put store my result in a php var?
Thank you,
Regards.
I'm using CURL to extract some real estate listings. But, recently, a website changed his way to municate the phone number: The visitor must click on a "Show the phone number" link that returns the result in jSon. I found these information with Firebug:
http://www.realestate./phone/click.json?Id=023DSFS
And for the linkn the code source is (obiously):
<a href="#" class="showDetail">Show the phone number</a>
So, how can I simulate a click and put store my result in a php var?
Thank you,
Regards.
Share Improve this question asked Jul 20, 2010 at 8:46 ZakariaZakaria 15.1k22 gold badges86 silver badges125 bronze badges2 Answers
Reset to default 5You can't "simulate a click" using cURL - the "show phone number" function persumably runs on client side in Javascript - and, I might add, was probably designed to prevent exactly the kind of cheapskate grabbing like you are doing. :D
You would have to parse the JavaScript code and find the JSON URL. Making a call to that URL using cURL is probably going to be easy, although you may have to get your headers right.
Seeing as they could be changing the principles behind that phone URL daily, though, this could bee very tough to keep up with.
Maybe you can simply do
$var = json_decode(file_get_contents($url));
This is assuming allow_url_fopen = On
and you don't need to have specific cookies for the http request to return the results.
本文标签: javascriptSimulate a click with CURL (PHP)Stack Overflow
版权声明:本文标题:javascript - Simulate a click with CURL (PHP) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744056434a2583339.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论