新浪短网址API接口源码
<?php
$url = 'https://check.uomg.com/api/dwz/tcn'; $method = 'POST'; // TODO: 设置Token $token = ''; // TODO:设置待缩短网址 $bodys = array( 'domain'=> 'www.aeink.com' ,'token'=> $token ); // 配置headers $headers[] = "Accept:*/*"; $headers[] = "Accept-Encoding:gzip,deflate,sdch"; $headers[] = "Accept-Language:zh-CN,zh;q=0.8"; $headers[] = "Connection:close"; // 创建连接 $curl = curl_init($url); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_FAILONERROR, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($bodys)); // 发送请求 $response = curl_exec($curl); curl_close($curl); // 读取响应 var_dump($response); ?>
转载请注明出处 AE博客|墨渊 » 新浪短网址API接口PHP源码
发表评论