grey5659
V2EX  ›  PHP

问个 curl 循环请求的问题,折腾好几天了...

  •  
  •   grey5659 · Apr 28, 2017 · 4068 views
    This topic created in 3340 days ago, the information mentioned may be changed or developed.

    大概的流程是:模拟登录网站,然后获取到指定时间所有订单号 billId,然后用 billId 去批量请求获得相应订单下面的数据,例如 www.xxx.com/getOrderDetailInfo.action?billId=00001 (比如到 00009 ),但是总是只能得到其中几条(不定数量),这到底是为什么额,折腾好几天了。。。。哪位大大能指点我下。。

    10 replies    2017-05-03 12:01:57 +08:00
    wellhome
        1
    wellhome  
       Apr 28, 2017 via iPhone
    加日志,加断点,以后问问题把信息提供全了,你讲的太范
    sunulin
        2
    sunulin  
       Apr 28, 2017 via iPhone
    又见 xxx
    grey5659
        3
    grey5659  
    OP
       Apr 28, 2017
    @sunulin 不是公开的网站嘛。。。
    Light3
        4
    Light3  
       Apr 28, 2017
    你先一步步来 打断点也好加日志也好 你看看究竟为何 你这什么信息也不提供 猜不出来阿
    grey5659
        5
    grey5659  
    OP
       Apr 28, 2017
    @Light3 嗯,也就是说 post10 个请求,有些是返回的空,怎么把返回为空的原因找出来呢?日志怎么加呢?请指点一下了,谢谢
    vjnjc
        6
    vjnjc  
       Apr 28, 2017
    把 url 和 response 的 pair 打在日志里!!!然后对返回空的 url 手动访问调试!!!
    yfl168648
        7
    yfl168648  
       Apr 29, 2017
    有没有可能人家有反爬虫
    grey5659
        8
    grey5659  
    OP
       May 2, 2017
    https://segmentfault.com/img/bVM2u0?w=472&h=436
    把 http 头打印出来,分别是返回数据的和没有返回数据的
    登录后把 cookie 存在 cookie.txt 里的,后面的 post 请求都是把这个文件传进去的,为什么这里 cookie 会变成这样呢?
    @wellhome
    @sunulin
    @Light3
    @vjnjc
    @yfl168648
    Light3
        9
    Light3  
       May 3, 2017
    @grey5659 应该是 cookie 存的不对..那个上面不写的你 session 状态不对么..
    grey5659
        10
    grey5659  
    OP
       May 3, 2017
    @Light3
    要被这鬼机制弄晕了....
    https://segmentfault.com/img/bVM4Bl?w=1342&h=574
    下面是保存为 cookie.txt 的 cookie 信息
    https://segmentfault.com/img/bVM4c3?w=773&h=111
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2617 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 07:40 · PVG 15:40 · LAX 00:40 · JFK 03:40
    ♥ Do have faith in what you're doing.