leguwork_public/short2long.php
2021-04-02 10:30:40 +08:00

20 lines
685 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
$url = r('url');//'https://url.cn/5MmbOlY';
$oCurl = curl_init();
curl_setopt($oCurl, CURLOPT_URL, $url);
//curl_setopt($oCurl, CURLOPT_HTTPHEADER, $header);
//关闭https验证
curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, false);
//至关重要CURLINFO_HEADER_OUT选项可以拿到请求头信息
curl_setopt($oCurl, CURLINFO_HEADER_OUT, TRUE);
curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($oCurl, CURLOPT_POST, 1);
curl_setopt($oCurl, CURLOPT_POSTFIELDS, $bodystr);
$sContent = curl_exec($oCurl);
//通过curl_getinfo()可以得到请求头的信息
$a=curl_getinfo($oCurl);
echo $a['redirect_url'];
?>