有人可以指出我在哪里做错了。这是我的代码:
<?php
$link = "http://api.stackexchange.com/2.0/users/534755?site=stackoverflow";
$var = file_get_contents($link);
echo $var;
?>
如果我运行这个片段,这就是我得到的:
‹ì½`I–%&/mÊ{JõJ×àt¡€`$Ø@ìÁÍæ’ìiG#)«*ÊeVe]f@Ìíť¼÷Þ{ï½÷Þ{ï½÷º;ťN'÷ßÿ?\fdlöÎJÚÉž!€ªÈ?~|?"~ñGE›/šŹ}ï´nòú÷/f=ºoÿÁýû#ù ½^å=ú¨Î/Š¦Íë|öÑè£iťgmQ-ÿYÖÒ—»{w<|¸û駣ŹfE³*³ëß™-ðÚ‹âmUfôʪ®Î‹2ÿý‹Ev/æm»zt÷îÕÕÕø¢Î.³6«ÇÓjqW~½›äû÷ïg³éÁìáù§ÓüÓÉÁäüàþÎùÎìáîÁìÓßcöY1Ë—m1–¿°þìåçÔEť¯Ö-ãECØyàðûOçÙò"'|¯?z´ûæ*Ïß|µ¨–í£Ś}ù‹ÖYMd¡£^çYŤW‰2<nüRfMûûgÓiÞ4†€÷î}zïáîÎÁž~»¨fÅy‘ÏÜ÷{÷vöîÝ£>Šæ÷Ï«²ºÎé‹ó¬lrz§X¾u4mÚlú¶ºÌëó²ºb¢b"›»2w—fJ®òIC³ÿû¯ë2ś²¸·“u9ÙnÚõ¬¨Ú—ÕT©ûÑI]ѯBã¨ÖË–ùfïþþÇ„â$›ÑÐùsâ¬_üÑEUζMQ^‚V÷¨M]-€¡íÿ’¯Úß¿–Áîìü’ïŹ>úEëªÍ~ÿ:_dŲX^ôæÓEöŽ€ìÄyÖ±jCŠ_òÿÿÿ”ÄÐ
而如果我在浏览器中导航到给定的链接,这就是我得到的:
{"items":[{"user_id":534755,"user_type":"registered","creation_date":1291799166,"display_name":"Nikola","profile_image":"http://www.gravatar.com/avatar/e8e455adc8d9f6ce6b8bf850f0d918d6?d=identicon&r=PG","reputation":507,"reputation_change_day":0,"reputation_change_week":0,"reputation_change_month":12,"reputation_change_quarter":57,"reputation_change_year":126,"age":26,"last_access_date":1336387120,"last_modified_date":1332302337,"is_employee":false,"link":"http://stackoverflow.com/users/534755/nikola","website_url":"http://www.lightbulb-studio.com","location":"Croatia","account_id":254997,"badge_counts":{"gold":0,"silver":3,"bronze":14},"accept_rate":100}],"quota_remaining":289,"quota_max":300,"has_more":false}