duanlei8119 2014-04-27 14:48
浏览 58
已采纳

从外部网站检索从JS加载的值

So here is my problem,

I am trying to retrieve a value from a website and copy it to a database on my webserver every 15 or 30 minutes. I want to do this because the value is the number of users connected to the website and I want to see when is the best time to post content in order to get the most views possible.

The problem here is that the value in question is loaded by Jquery and therefor I'm unable to user DOMDocuments to get the value since it isn't initially loaded with the page itself

I also tried to use Jquery to retrieve the page in order to get the value but it didn't load the value in question.

Then I searched for the script that filled in the number of users and found the post Jquery function that loads the value but haven't been able to retrieve it. I then discovered that the external server must be configure in order to accept cross browsing !

Now I don't really know what to try. Does any one have an idea what I could try next ?

Here is the link to the webpage containing the number of users onling bit.ly/1ljFkhh ( at the bottom of the list on the left side)

  • 写回答

2条回答 默认 最新

  • duanhanglekr37902 2014-04-27 16:01
    关注
    $source = file_get_contents('http://www.newschoolers.com/post/chrome.php?a=online');
    
    echo count(json_decode($source)->ONLINE);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog