号码小助手,会自动将号码分析成:AAAB,AABB,ABAB之类的方式。
调用方式:http://ixyz.sinaapp.com/api/phone?h=13912341234,13912123344,13912345678&type=json
默认返回值是json,可支持json,xml,text三种返回形式
号码最多一次传10个
PHPCODE:
esult = file_get_contents('http://ixyz.sinaapp.com/api/phone?h=13912341234,13912123344,13912345678&type=json');
返回值是:
json格式返回:
{"phones":{"13912341234":["ABCD","ABCDABCD"],"13912123344":["ABCD","ABCDABCD","AABB","ABCD","ABAB"],"13912345678":["ABCD","ABCDABCD","AABB","ABCD","ABAB","ABCD"]},"copyright":"Written by walkerlee, api support by gouki","error":"sorry,phone doesn't match"}
xml格式返回:
XML/HTML代码【xml返回的格式结果与json的有一点点不太一样】
- <?xml version='1.0' encoding='UTF-8'?>
- <root>
- <result>
- <phones>
- <phone number="13912341234">
- <ABCD>ABCD</ABCD>
- <ABCDABCD>ABCDABCD</ABCDABCD>
- </phone>
- <phone number="13912123344">
- <ABCD>ABCD</ABCD>
- <AABB>AABB</AABB>
- <ABAB>ABAB</ABAB>
- </phone>
- <phone number="13912345678">
- <ABCD>ABCD</ABCD>
- </phone>
- </phones>
- <copyright><![CDATA[Written by walkerlee, api support by gouki]]></copyright>
- </result>
- </root>
----------
目前支持的类型有:---------XML/HTML代码
- Array
- (
- [0] => AABB
- [1] => ABCD
- [2] => AAAB
- [3] => ABAB
- [4] => ABCABC
- [5] => ABCDABCD
- [6] => ABBB
- [7] => ABCCBA
- [8] => ABBA
- [9] => AAAA
- [10] => AAAAA
- [11] => AAAAAA
- [12] => AAAAAAA
- [13] => AAAAAAAA
- [14] => ABCDCBA
- [15] => ABCDDCBA
- [16] => ABCBA
- )
以上类型可以根据需要随便加,如果你觉得有哪些规则不错,你可以告诉我(这个正则是自动生成的,因此只要告诉规则就OK了)
嗯,这个程序的核心函数是walkerlee写的,我只是稍稍的封装处理了一下