1

我正在尝试使用 PHP Curl 自动注册https://www3.gotomeeting.com/register/432624022

根据人们所做的更正,这就是我正在使用的:

<?

$array=array(
    'Name_First'=>'Steve',
    'Name_Last'=>'Jobs',
    'Email'=>'steve@jobs.com',
    'Template'=>'island/webinar/registration.tmpl',
    'Form'=>'webinarRegistrationFo‌​rm',
    'WebinarKey'=>'432624022',
    'ViewArchivedWebinar'=>'false',
    'registrant'=>'',
    'RegistrantTimeZoneK‌​ey'=>'55',
);

function dump($logArray) {
    echo '<pre>';
    print_r($logArray);
    echo '</pre>';
}

function go2webinar($array){

    $url='https://www3.gotomeeting.com/en_US/island/webinar/registration.flow';
    $url1='https://www3.gotomeeting.com/register/432624022';

    $cookie='/therightpath/cookie';
    $query=http_build_query($array);
    $c=curl_init();

    curl_setopt($c,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1');
    curl_setopt($c,CURLOPT_URL,$url);    
    curl_setopt($c, CURLOPT_FOLLOWLOCATION,1);
    curl_setopt($c,CURLOPT_POST,count($array));
    curl_setopt($c,CURLOPT_POSTFIELDS,$query);
    curl_setopt($c,CURLOPT_RETURNTRANSFER,1);
    curl_setopt($c, CURLOPT_SSL_VERIFYPEER,false);
    curl_setopt($c, CURLOPT_SSL_VERIFYHOST,0);
    curl_setopt($c, CURLOPT_COOKIEFILE,$cookie);
    curl_setopt($c, CURLOPT_COOKIEJAR,$cookie);
    curl_setopt($c, CURLOPT_REFERER,$url1);

    $r=curl_exec($c);//result
    dump(curl_getinfo($c));

    if(curl_errno($c)) return curl_error($c);
    else{
        curl_close($c);
        return trim($r);
    }
}

//GotoMeeting
echo go2webinar($array);

cookie 正在按应有的方式保存:

# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This file was generated by libcurl! Edit at your own risk.

.gotomeeting.com    TRUE    /   TRUE    1371763493  g2mVisitor  FirstVisit%3D1340218507523%26LastVisit%3D1340227493492%26RSN%3DDEFAULT
www3.gotomeeting.com    FALSE   /   TRUE    0   g2mSession  SessionInfo%3D200000000139397572%253A2B00BFBA6275B45
www3.gotomeeting.com    FALSE   /   FALSE   0   JSESSIONID  abc6tY1HKr4Hh9l-3plGt

但是,我现在收到“网络研讨会不可用”页面......

4

1 回答 1

1

这是工作脚本,我把它编码得太硬了,但你应该知道什么是不工作的。

  1. 利用curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1);
  2. 用户代理curl_setopt($c,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1');
  3. 始终使用 firebug/tamper data 找到正确的参数这是篡改数据屏幕截图
  4. 您应该发布到$url = 'www3.gotomeeting.com/en_US/island/webinar/registration.flow';$url1='www3.gotomeeting.com/register/432624022'; 使用 $url1 作为推荐人。

    $query="Template=island%2Fwebinar%2Fregistration.tmpl&Form=webinarRegistrationForm&WebinarKey=432624022&ViewArchivedWebinar=false®istrant=&RegistrantTimeZoneKey=55&Name_First=BobS&Name_Last=Gnoomw&Email=asas%40cc.com&RegistrantTimeZoneKey=55";

     function curlit(){
    
        $url = 'https://www3.gotomeeting.com/en_US/island/webinar/registration.flow';
        $url1='https://www3.gotomeeting.com/register/432624022';
    
        $mypath = getcwd();
                $mypath = preg_replace('/\\\\/', '/', $mypath);
                $cookie = "$mypath/cookie.txt";
            $query="Template=island%2Fwebinar%2Fregistration.tmpl&Form=webinarRegistrationForm&WebinarKey=432624022&ViewArchivedWebinar=false&registrant=&RegistrantTimeZoneKey=55&Name_First=BobS&Name_Last=Gnoomw&Email=asas%40cc.com&RegistrantTimeZoneKey=55";
            $c=curl_init();
    
            curl_setopt($c,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1');
            curl_setopt($c,CURLOPT_URL,$url);    
            curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1);
            curl_setopt($c,CURLOPT_POST,count($array));
            curl_setopt($c,CURLOPT_POSTFIELDS,$query);
            curl_setopt($c,CURLOPT_RETURNTRANSFER,1);
            curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 0);
            curl_setopt($c, CURLOPT_COOKIEFILE, $cookie);
            curl_setopt($c, CURLOPT_COOKIEJAR, $cookie);
            curl_setopt($c, CURLOPT_REFERER, $url1);
            $r=curl_exec($c);//result
            dump(curl_getinfo($c));
    
            if(curl_errno($c)) return curl_error($c);
            else{
                curl_close($c);
                return trim($r);
            }
        }
        function dump($logArray) {
            echo "<pre>";
            print_r($logArray);
            echo "</pre>";
        }
    
        //GotoMeeting
        curlit();
    
        ?>
    
于 2012-06-20T20:55:17.587 回答