Jquery:
1//Get Domain Name 2 function getdomain (URL) {3 var a = document.createelement (' a ');
4 a.href = URL;
5 Url=a.hostname;
6 return URL; 7} 8 9//Record visitors ' function recordvisitor () {one var referrermz = Escape (GetDomain (Document.referrer)); var hr
EFMZ = Escape (GetDomain (window.location.href));
sendinfo= "judgemz=413322&referrermz=" +escape (REFERRERMZ) + "&hrefmz=" +escape (hrefMz); $.ajax ({type: "Get", Async:true, url: "Http://www.mazey.net/config/api/record -receive.php ", Data:{judgemz:413322,referrermz:referrermz,hrefmz:hrefmz}, DataType:" Jsonp ", 20 JSONP: "Callback", Jsonpcallback: "Returnfun", success:function (data) {myarr= Data.split ("-|-")-if ("0507" ==myarr[0)) {Console.log (myarr[1)); 0215 "==myarr[0]) {Console.log (myarr[1]); 28} 29}, 30 Error:function () {console.log ("Server error!"); 32} 33}); 34} 35 36//load of $ (document). Ready (function () {recordvisitor (); 39});
Php:
1 <?php
2 require '. /config.php ';
3 $judgeMz =$_get["Judgemz"];//todo follow-up to do a validation is not 413322 error
4 $referrerMz =$_get["Referrermz"];
5 $hrefMz =$_get["HREFMZ"];
6 $visitorIP =getip ();
7
8 $data = Returnfun ($referrerMz, $hrefMz, $visitorIP);
9 Exit ($_get[' callback '). ' (' Json_encode ($data). ')');
One
function Returnfun ($referrerMz, $hrefMz, $visitorIP) { $urlRecordVisitor = ' http:// Www.mazey.cn/config/config-asp/api/record-receive.asp?referrerMz= '. $referrerMz. ' &hrefmz= '. $hrefMz. ' &visitorip= '. $visitorIP; $resultMz = file_get_contents ($urlRecordVisitor);
return $resultMz;
?>
Other:
Because Http://www.mazey.cn/config/config-asp/api/record-receive.asp is at home, it seems a bit slow to visit. Prepare to rewrite PHP's back-end writing code in accordance with ASP, originally planned a lot of things, other things this step after you finish.
Link