366API conscience provided in the micro letter, click on the link to jump directly to the phone's default browser function code

Micro-channel built-in browser can not open the link how to do? Always block third-party micro-channel promotional links and how to do? This is the latest in the forum and posted it many users consult my question, in fact, difficult to solve this problem, we just use the micro-channel API interface can jump perfectly to avoid the above problems.

So address this issue, close-up this article to share treatment options before our company. First, if we do not have professional technical team, we can look for a provider of a team of this technology, we have been using before is 366API platform interface, the results were good, very stable. Then if we have our own technical team, a jump can write their own programs, reference case see below.


I. First, we talk about the use of 366API platform:

366API we need to use 1, use your browser to open
2, copy and paste the link into the api tool box, click on the link and generates a short jump two-dimensional code
3, copy short connection and two-dimensional micro-letter code go to open a link or scan code can be.


Second, secondly we talk about how to build a micro-channel jumps browser source code:

? <PHP 
// unified call micro-channel whitelist Interface: https: //api.366api.cn/mjgj/link/GetOpenLink callback = getOpenLink & rurl = https:? //dc2.jd.com/auto.php service = transfer & type =? pms & to = (here spliced own content address such http://mjbbs.jd.com/data/attachment/forum/201806/08/173526pb2zpjzzooo2ofze.jpg) 
IF (the GET $ _ [ 'T']) { 
// the include ( "ADMIN / the config.php"); 
// the include ( "ADMIN / function.php"); 
$ code = $ _GET [ 'T']; 
. $ info = Query ( "jump_logs", "WHERE code = '" $ code " '");. 
IF ($ info [' code '] ==' ') { 
    echo' jumps fails'; 
    Exit (0); 
} 
IF ($ info [ 'State'] == '. 1') { 
IF ($ info [ 'COUNT']> = $ info [ 'NUM']) { 
    echo 'jump failed';
    Exit (0); 
} 
$ Time = strtotime ($ info [ 'Time']);
    if(time() > $time){
        echo 'jumps fails';
        Exit; 
    } 
} the else { 
    echo 'jumps fails'; 
    Exit; 
} 
IF ($ info [ 'www_url'] == '') { 
    echo 'Please configure the landing page'; 
    Exit; 
} the else { 
    $ $ = info w_url_code [ 'rl is an']; 
} 
>?
<?php
function get_ticket($code){
    //初始化
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // https请求 不验证证书和hosts
    $headers = array();
    $headers[] = 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_1_2 like Mac OS X; zh-CN) AppleWebKit/537.51.1 (KHTML, like Gecko) Mobile/15B202 UCBrowser/11.7.7.1031 Mobile  AliApp(TUnionSDK/0.1.20)';
    $headers[] = 'Referer: https://m.mall.qq.com/release/?busid=mxd2&ADTAG=jcp.h5.index.dis';
    $headers[] = 'Content-Type:application/x-www-form-urlencoded; charset=UTF-8';
 
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    $content = curl_exec($ch);
    curl_close($ch);
    //$arr = json_decode($content,1);
    //if($arr['success'] == '1'){
    //    $shotCode = $arr['shotCode'];
    //}else{
    //    $shotCode = '';
    //}
    //preg_match('/openlink\":\"(.*?)\"}/',$content,$result);
    //$url = $result[1];
     
    preg_match('/href=\"(.*?)#wechat/',$content,$result);
    $url = $result[1];
    return $url;
}
    $time = time()-$info['ticket_time'];
    $minute=floor($time/60);
    query_update ( "jump_logs", "count=count+1". " where code='" . $code . "'" );
    if($minute >= 59) { 
        IF (URL $) {
        $ = get_ticket URL ($ w_url_code);
        // if more than 1 hour, update Ticket
        query_update ( "jump_logs", "ticket_time='".time()."', ticket='" . $url . "' where code='" . $code . "'" );
        $ticket_url = $url.'#';
        if(strpos($_SERVER['HTTP_USER_AGENT'], 'baiduboxapp')||strpos($_SERVER['HTTP_USER_AGENT'], 'baiduboxapp')){//安卓百度手机APP
            echo '<script>window.location.href = "bdbox://utils?action=sendIntent&minver=7.4¶ms=%7b%22intent%22%3a%22'.$url.'%23wechat_redirect%23wechat_redirect%23Intent%3bend%22%7d";</script>';
            }else{
                echo '<script>window.location.href = "'.$ticket_url.'";</script>';
            }
        }
    }else{
        $ticket_url = $info['ticket'].'#';
        if(strpos($_SERVER['HTTP_USER_AGENT'], 'baiduboxapp')||strpos($_SERVER['HTTP_USER_AGENT'], 'baiduboxapp')) {// Andrews Baidu mobile APP
            echo '<script>window.location.href = "bdbox://utils?action=sendIntent&minver=7.4&params=%7b%22intent%22%3a%22'.$info['ticket'].'%23wechat_redirect%23wechat_redirect%23Intent%3bend%22%7d";</script>';
            }else{
                echo '<script>window.location.href = "'.$ticket_url.'";</script>';
            }
    }
}
?>
<!详情可参考:http://www.366api.cn-->


Guess you like

Origin blog.51cto.com/14376894/2404540