Language: HtmlPhp
縮.jp api for tweetie
1: <?php 2: $ch = curl_init(); 3: curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 4: //the url of api 5: $url="http://api.xn--jj0a.jp/generate.json"; 6: curl_setopt($ch, CURLOPT_URL, $url); 7: //I dont know why but I have to set the agent or it will return 403 8: $useragent="Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; en-US) AppleWebKit/532.6 (KHTML, like Gecko) Chrome/4.0.267.0 Safari/532.6"; 9: curl_setopt($ch, CURLOPT_USERAGENT, $useragent); 10: //the query , for more detail: http://jamadam.com/blog/?b=3557 11: $query="fUrl=".$_GET['url']; 12: curl_setopt($ch, CURLOPT_POST, true); 13: curl_setopt($ch, CURLOPT_POSTFIELDS, $query); 14: $json = curl_exec($ch); 15: 16: $result=json_decode($json,true); 17: echo $result['result']['generated']; 18: ?>
Report Abuse
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search

