api接口类型
类型一:js+xml
类型二:纯php模式
参考:
<?php $ip = '117.25.13.123'; $datatype = 'text'; $url = 'http://api.ip138.com/query/?ip='.$ip.'&datatype='.$datatype; $header = array('token:00d5cb1fac5dc5cbfe2ff218292a2dfd33'); echo getData($url,$header); function getData($url,$header){ $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_1_1); curl_setopt($ch,CURLOPT_HTTPHEADER,$header); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,3); $handles = curl_exec($ch); curl_close($ch); return $handles; } ?>
类型三: 远程ajax
<script src="http://www.xxx.com/Ajax.js" /></script> <script> var a =xxx var b=xxx function ss(a,b){ $('XX').html('1111') } </scirpt>