Download flurry event log using curl

前端 未结 1 665
南方客
南方客 2021-01-13 17:05

I started to use Flurry Analytics and have found that it\'s analysing tools are insufficient and too slow. Simple funnel of 3 steps was processed for 3 days, while normally

相关标签:
1条回答
  • 2021-01-13 17:45

    The struts.token is a CRSF token which is bound to your session and regenerated on each page load. In your code though, it's static. You need to fetch it after your first cURL request and then inject it into your POST array to be used for your second request.

    Also the page you have to login to is /loginAction.do and not /login.do.

    This is how I successfully logged in to Flurry:

    $post = [
             'loginEmail'        => 'E-MAIL',
             'loginPassword'     => 'PASSWORD',
             'struts.token.name' => 'struts.token'
            ];
    
    $ch = curl_init('https://dev.flurry.com/secure/login.do');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
    curl_setopt($ch, CURLOPT_COOKIEFILE, null);
    
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    
    libxml_use_internal_errors(true);
    
    $dom = new DOMDocument('1.0', 'UTF-8');
    $dom->loadHTML(curl_exec($ch));
    
    $xpath = new DOMXPath($dom);
    
    
    $post['struts.token'] = $xpath->query('//input[@name="struts.token"]')->item(0)->getAttribute('value');
    
    curl_setopt($ch, CURLOPT_URL, 'https://dev.flurry.com/secure/loginAction.do');
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
    
    $data = curl_exec($ch);
    
    
    echo $data;
    
    0 讨论(0)
提交回复
热议问题