Micro-channel two-dimensional code scan how to do in the built-in browser can not open the file download link? Easy to solve with 366API

Now a lot of micro-channel sharing function, from sharing link to download the app is a very commonly used functions. But micro-channel scheme interfaces will automatically block containing the download link or ios apk file, do not allow directly through the micro-channel download the installation file. Intercepted link will prompt the user to open the "stopped to visit the page" in the micro letter. But many users do not know is blocked, so that there is a link problem, and finally lost in this step, for the business to promote the conversion rate will naturally be pulled down.

At this point you need a direct download app in the micro-channel function, which I studied for a long time, I explain to you the following recently learned 366API.


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


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 connections and access to micro-channel two-dimensional code to open a link or scan code It can be.


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

1, ios end micro-letter code hints Masking go browser to open

<style type="text/css">   
    .mask {     
            position: absolute; top: 0px; filter: alpha(opacity=60); background-color: #777;   
            z-index: 1002; left: 0px;   
            opacity:0.5; -moz-opacity:0.5;   
        }   
</style>
<pre class="html" name="code"><script type="text/javascript">   
    //兼容火狐、IE8 
    //显示遮罩层  
    function showMask(){   
        $("#mask").css("height",$(document).height());   
        $("#mask").css("width",$(document).width());   
        $("#mask").show();   
    }
    //隐藏遮罩层
    function hideMask(){   
        
        $("#mask").hide();   
    }
   
</script>
<div id="mask" class="mask"></div>  
<a href="javascript:;" onclick="showMask()" >点我显示遮罩层</a><br />

2, Android end micro-channel automatic wake default browser to open Web links 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-->

2, Android end micro-channel automatic wake default browser to open Web links 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 
    $ w_url_code = $ info [ '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/14361275/2401084