我写了这段代码而我没有得到任何结果。
出了什么问题?
> diff(df$visitor) #Difference between values in each row.
[1] 0 0 133 0 0 0 533 0 0
> c(TRUE,as.logical(diff(df$visitor))) #Converts to logical and add a lag:
[1] TRUE FALSE FALSE TRUE FALSE FALSE FALSE TRUE FALSE FALSE
> cumsum(c(TRUE,as.logical(diff(df$visitor)))) #Then cumulative sum.
[1] 1 1 1 2 2 2 2 3 3 3
答案 0 :(得分:0)
$html = curl_exec($ch);
$info = curl_getinfo($ch); // Add this line to your code and print
来自$ info的部分打印结果:
["http_code"]=>int(302) // This code say you need load url from "redirect_url" (if not empty)
.................
["redirect_url"]=>string(314) "........." // You need go to this url (try curl with this address)
注意:如果" redirect_url"将会清空,但您没有收到网页内容,您需要为curl-query启用标头,从标头位置提取网址并将其用作curl的下一个地址。 ;)