php - 关于网易云音乐搜索api的返回结果问题
巴扎黑
巴扎黑 2017-04-10 15:48:01
0
2
4817

用php curl 请求

<?php
header("Content-type:text/html;charset=utf-8");
//网易云音乐搜索api
//$url = "http://music.163.com/api/search/suggest/web?csrf_token=";
$url= "http://music.163.com/api/search/get/web?csrf_token=";
//搜索关键词
$s = urlencode($_REQUEST['s']);
//每次检索数量
$limit = urlencode($_REQUEST['limit']);

 
    
function curl($url,$s,$limit){
    $curl = curl_init();
    $post_data ="s=".$s."&limit=".$limit."&type=1&offset=0&total=true&hlpretag='<span class=\"s-fc7\">'&hlposttag='</span>'&#/outchain/2/28371369/m/use/html=";
    //$post_data = "s=".$s."&limit=".$limit;
    //$post_data = urlencode($post_data);
    //$psot_data = "hlpretag=%3Cspan%20class%3D%22s-fc7%22%3E&hlposttag=%3C%2Fspan%3E&%23%2Foutchain%2F2%2F28371369%2Fm%2Fuse%2Fhtml=&s=".$s."&type=1&offset=0&total=true&limit=30";
    curl_setopt($curl, CURLOPT_URL,$url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
    //curl_setopt($curl, CURLOPT_CONNECTTIMEOUT,10); 
    //curl_setopt($curl, CURLOPT_REFERER, 'http://music.163.com/search/');
    //curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36');
    
    
    $header =array(
        'Host: music.163.com',
        'Origin: http://music.163.com',
        'User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36',
        'Content-Type: application/x-www-form-urlencoded',
        'Referer: http://music.163.com/search/',
    );
    
    curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
    
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
    $src = curl_exec($curl);
    curl_close($curl);
    return $src;
}
if(!$s||!$limit){
    $tempArr = array("code"=>-1,"msg"=>"输入参数有误!");
    echo  json_encode($tempArr);
}else{
echo curl($url,$s,$limit);

}

?>

但是返回的结果

{"result":"35b1748964afb6f6ab00803a0762fb42b1748964af8a7c1d883e3a6f3c773bf4ab232f7449bad4bbaf1fb194773bb1f3cd7f9272346d3f45a4ee567742b1a89e09ca6454cbbaac7dfd89a24d3aff3252e2e41f3b559f509f89d10df752edbd749c84d9b5a84ecf91295e675f4dafe8d76834730438bc2f7ae2569862cc6e8a4e48061068cbd0b023248974186e72002e3a17c68198a37ccf6383123692173b76c738260aa8527aa2eb46f1f85ba0ab22960db1ed031d8c7feffba17bff3a4095efa50a2a517aec39e8743c7f23b1294e12c831cc97f63cadb6777dbb1afb1f9b46af39cb8ce9580f41487c20fb6a018a97b03842126dded8a067022366a6d56d3b5fdcf6a7107887b33c302cdd1577ffc6bc3c5637200a030f85d8694faacc999639b08da2447a3a1eb43fede49c12ec6bbbd37a57d8e9f2553ad6d6b3552096af75f585e310347c1d570425220d868b48ece8f2bf001f07deb09cb68b8a440a02c89a219fc1b3d3fdfa67b26fca733396818eda92b83f042689c968077cf50ed2b187380e5f00eecf325f3e7f297c90a68c969cb5a5c26b17d19d9712de9b183a18a1016b2d81f2e7bf0bec7251bb9a71ddaeb9fae6d4e65dc8245bb8c10b97565fc72f8aad139ed70f4b0a4789760db0d2ac0d16ff3808577ecdc59832cc262f613e2146c275620425e0b65dc6579dbc0663a276819d954ba638c503c1b0e3d876781f53ed730f24de74a32da119ba57b8dd2d07dadacd0c9a3aa0fb0434f63ec05e1f7ab27b7b04dd7f4ed93a05fbac68a6ac32ebc74b8ccbf5a039f42f428ef4344ee796d399e03431e29148f55d0891413e79c598b41fdbe8be81970710c838f94b455e841e62cdb1bc1e07fb641f9c4095f1bc42241f96eef55f143ec1fb646296b39d04c9d7949fb36bba04d8392e54fd0331a681d9cd3abf7007a0e6727f20b29bc9cf018033af94681a87194ecc10e631cfde9568adfb85175f81c19c79a885162168489faaab2e5f92b262de5815dda604f1ec0819ecb1bcb0af33ef64d6150148e7ff950dbac917c5de37ddf9c985b31f630816fcf2d0ea723ec0c78bfbbead3ea859ed39aed61898b16205f5c5f948f05a9a8916442f01036dca22a0f9982d48cf9111b04c3368f920e876d8335f11558974f6bcb108a48707a838af1e365ee802c94d896af9019ff5c1ae20ef94a4e8176de0bb483a7f3a957479af507779643d9f976c884a4c468ccbeeb20cd4b8c6c7aa204e5749edf6c325b601db50d81ede74eaa082a86afd239c66ec402ea5cb16e889d118b15a4fa5e7328cf19aa8228ae91152a0ff3a5629424a9a7404a6f2c11211d9c6d958751fc4616487de652c5f0a4385041f5b31396110bcb2492133ec43a3cd89079e22cb74ec3e4d1095f126b26d58be4adbf9eb3a796b4562a542b25f166bff35c087b58585ba3acd45ae4601e7053ae9d9e03ca6d6b5e29ccb04bac7b77bbee2a1a895fb8cfdd510e69b4efd3b062356089cb2ec7f409652df327c19053425d3cb05fb5f1f87030b74ae518525dffd8f14518fca9c1fa7f6b463aaba60436e6f385ce350b7369bf235d976fceb4bbb90fb7311338051e208ea1dd8c5a2b1633874a5b49e77043e8a2c918d6d4e1e3fcfe3830f9ce6db4ac0d1de2d862d4014de7fad3d45d1628992625486643a40665750417c62bb6b5616bccfa3549589854fb362b56beafbd11fd62695482673d347514840c23d3442b490a3745eddde4bfb2079810432c1d9575bb36bab9f8d3ac68541030b670b2e85e47eaed757c2635107e77c0b818d8ee38eff624207c14682c18cf556aaec6209f66de4cf050c27148c697f74ec33eac6cd00833e093a090ede9c7c0640ddae622284a0041941c108a5b28edc85a1557e1866787b9f897495c0067ab353bac1afd834dd8e4018bac55942ee83405f9c10a225829db10b9e0323bd18d7c1a7102412d95f1f53c148f5e009ecf5f51f763bca133247cf02c05fb279a8af4d62e31436ce018584c58940b4b249a913c91ac915ed6b57a840eb8a394ea87e33d22b04f1bc2c658256193cde74bc3ce497bceba1012a7ecfde3ae95731ae4875747ea503b26d268504a2969a7c74afaea16b21684892ea69efddc799d9ec038538edb08dd0c295dc68eb6fc7bf2a09c0a9e6dd7373da0c752b5069926c43f27ed5b6ecdc4e3ad3744813f1e98e30ae4ab05ba08bcbc295f425fc48ad9cf9dd2d30b65e48f93a4e4c14724aa09977a89c3e9576eec1cd4be599c91710f52d9c22f5851e10dcfd8bea6a94ac632bb3d057dc91583cbe1223a2149f89fbd39038129a1020ab5b3c72f937d7b4afa37c1f1ada0ac1743f56f4cfa3956bc5ee02b83aa479c7106803cca45bbbdb52b70aadf2eeaf1c5c4e1de2f6f6b56e58c638a8e2af2e0448d5d3c16794c9f5918abc54adad49953b972c943d15624022250fd3a6633d2d5fa854cfc846819c2e4e1fba8778ebdb9e52e0042219f5222c3810d67848dd0a96249e83b67064cf89a60aa357167baebfdb99c586ccde790e62ba8ea5512a6a751375a7ffbb71ca696807aaa0a89e6bdbad4d0540e683790273b82ef5498ed14f73b5040d0ebbff996d3929d811034a2fc6a8a498f9d7d8dd89fbc81ffb89ddbf575de09a80675172f5299f5525dba67255bc630b4a3a327c3dd3c2f55907f4483b4e3ad93afb085eab9a232ce01f8202469538f60383eef453669599b66e2cc205c73637047b2024312d05bb0e372ff47c1d8cc718fd4e17c2a6a841cced62590ca06576258199616699d16d96b50eba9262c2846204783fe73ba50a30563bb2edf96311042c89485753a9e6793b97929463ae85cd9abc5f3a74ec3342360434cf5f422ca07c98967aeb835bfde6a0e6f685f7cfe0b61259657a0c203a0390332dfaeed139102d18c5625349ea81c685a58b69113501e4688142145f796d629745a395e3959e07f1143a5f8b666026cd1167d49fd446621848508ca0f6ba26a6c3304592be89db4f44ffad7496af83fdf14396bef6a2ef8713ff62459cfc047c6b3e6d4ad1a1622f4eec542dde0e95f998426415928562eb1447c221e4712d5585b5cf0980539c13bad3ba3011ebae66b331049719a835ae7f47b3229d2c0ab17a281c41f8944ddeba13a3570bc2ae8dac489586b805baff6238abaf51036a75ff97a7cb898dca07db3daa85a89edba44f1d0568e6b1fdc3ee4ba6ac6110dce4438a0785ea387934af5ee2b361a83a7510c77c50a786cc1186596b6b1beae00e86937d01609c3eb6307d96761fdba61172ae3e663b07322444a3f11f9c2ec538f212e23917b517a54abcba0aa00799a710dc87a1c8f6de6bd608132df2969c1c4e38cfe28d57ec50aa322e85e69cba04f1093cc14aedfdf5a48a3154ad6a922f1de99cb66587e9a5a307cad2216a152d5f37544da480f99c2e8c5fba87112edb1e4d31047568f59891a610b76f9d090ac011288341e1d0cfbba673a30903ad432bb1591635fb408aa5ed4245af51166a75b5752cff893fca69d92caaa0a8996bdba31d05d87b83b800bab80a40b829d1b3b0a204dda6a695806d5d80d6cb53799a07a86be2813fa61faa96334a310413da4ab15f30713b4c33d93b0155aab513cdaeaee23467e2e6f5aa66ec79e6019ee01dde79a10e0eb8c8788b8a2ca0e964fa3a39893a553cdea3d2623859a23e73a18cd1840aa80d9ee483df7c85de0d4e45eccfdee3958985e7af859ed8a0c8d2a61da1a885eb99e8a6a8e03e16e495389be0e83a093853e79590a8f5721f4a2f21dbd759778a3a260e2de7473706dd106856902c92bba02952df38cdeeafffee7c8a89a2b717c679d6e05136738c6287ecc00b0d40e60f90401b6859ca7f0714d4027c84bb8a69011ab040855f3e0b65a808aedef2c289fb628b663149df9abc471a8933195ce36adfab32e2a7aec0d1089295dd5bf4538596e03acda3ea951ac9ce1c09898a9cc8010390054b0953792d48cf17b47e8fd340537ae8566b0ada7b2989d1bebc0b522c66628597dbd5ad794f15cd264764dd10ffe8566a8cdfd1a4b2dbe2e08906a87f3a047406af9b9179643d112a1bce2220681ecbc94573601e13c7fceb4ec70eed92a402e2d99ddb36dc264b2df1cb839dfcdeb366ec3790a55e8e3c8974951f5a4fa5e7ff8ccc15a8228a89e0cad9fff1ab5e511ed5a692cab07a83a0d96a6071da529228257b014b36b622db76c77cc99e37fd10bc307f218eeccfa3d8bbd99e22cb74303ef92195f1263ec14c8d4ad8814b6b9826ff859c633c11126bff677872bc62dda2d300ff3c9411d9d704bf72596247d6b5e24dcb95ba6bb776bfeea1a895fb38fd9a21e69b4ed244060f5608afb2b421a066d64bd34e579d3425338ee7fb2432136bf151a2c37cf5084911eea8f9e99c1fa792b409aa8c60cf6eda385ce3504d36657435d976b8794b2d90fb2a113c6aedc1e78d1da004a2b1633874b3b43e9aac957cc7399b4d4abe5163f940ea9ce6db366dca59535e746814897fc53d457462bb3d6254865ea8406657500f7c57de34963ca2cfde3a8907924d38a60d6e53999deecf2f9f7b4ce8cd44305bb6d17a7267b259266b84d7ff161872f9eb7cf582995d3d385361d24962bb7cc8b6fbe907c369a5b4a7800fed98f52f1fa2146271d1512edef29e188c1e85caa8659c3cefd82f2115f498bb64c51876d374f97ce2af6165a6a3d54514b299f542b1b41e90abef7c81008ad62506d8fb9d4098ba2137b8b56be86beb3e681a5691d5975d6f34021362c05fdaab8537760fa1a00dd921f6af9c830369856506872d21851885ed3a22a62995bced79f55dca426e2f212faf292495a017f2bd46e4de658fdbb8e2c8a652b331c425a557d777cb4813eed63d024fec1295dde86eded62d13c9cb4227a5539f0409de1ed8c7a3fbeac321acd29abbc3aefd3003b3ab9019a05930c18c63b44f6ebafeae83c9629c61c98226d238a02c6bbb47bc5b320e6f071eef0ec801c7b805550670080e0dab19c736e1c0025d1e4d807fc2804f0d07e2f403ef8a74e3743c5e3474bbfbfbdbf40b10dd9ca87ccfb2b1b216247cd6b229d920ffa8af37afdf7e3a38a2d60548fdb30add8cd2c7f70595725ba61840394430f3615ba5160dc1daf890f9a2b821ffe0e0f971c8e8c103e46226c8172e0aa2d71532a8b0ecb0322c09e6402c1ffff50ff3341f1d05b39765b1ada5ad38f538a8b433561b0448bcea5016aa91e8de64bcb2e432a87bc96d67b33aba04c8d2794b541139a64d0067d66e483a8c18e7bf952c0c9963bbd16b3ba2b7403e4db307ec0385b8d1b08dd01ec5dcdb162ac75b2a07336c02f4ff432a1d0c0cae74f144c91890c4e3547948f11021b597be36800a740559915e2614a6bae4a0db31e2a5f9dd2d30455e48f9d996e9d91129bb594095578f119b248974a1baf5cb4d7e78410d2ede7972d895da163e4aa53c878ac810e2d8c78202ec8a2a52c2b8a2b26aaa316e853f64510b89f21e18c9020a6bd9c6f94b2e9091ffd8ff7ff54034bf94413ec3a325608907fcf681441377ff1f9cc6dead727948ded991763aca13a810eb4eea3ab519b80789b11a5e3111cb661e229aa629e21fb1722ca76035f6660e6297a6acba9a89e2366f553acac0e8e6ad5635b60b89741818c92f3979c61fcafcd979070aa8a26bdfbf16d90a04619618e2a16da882930d831abb2121bf96ec7f5463ecfd1a8955fce2d17be31df137149a14f10789c077018bb009a8bcc27a2c31f56810db2dbf06c3c5a8063a04e937ddd61ea8dfad782b56b8d8284d4ebc359df4e866c889f2e4bc765d3d99f57c9dbeb57c538f45bba0b75d89fb07c5d78ca8c09c2ec54863557e82ed79a86aaa5f54ad0dae17cf8baf3525722d4405074f0adacb94e9ae04dddb6f0809a6874d73b6d1767beb56e039e398b72455380e10d6789dddd796201e1cdfe1d04389a659a3098f531dd84e99b5e3fba078b7ed348a6b067536ac4bf289fba0de0ebb562f107e9b7e72f9480713c5e36e32b179c910346121dcac4d73076b62a613b0b7d76abe13855e7eab0a85dd724d446461a3b6cac4389c7e0c2ebcc278e6b276c3898d5f3ccf628396f6e0337910ec3c9e7285e64479a348cf9bb056b279a8afb132960915e2d0526a95dd17f48b859631620da47a2fcff90a4c6e7966a0fdd8859dae4601cfde40bbd824d3a6d6bab11a243ec1853c6d562e89d192ecaab7c8b16285a12642ad385215cd2647eddd105eb2552d5dc264da0f1e6f2f3a39b18e5ff2ae51858382a6ce14ed28ca9c6ddb68baeb792ec49accffc7fc9048db7351bea402e23acbdb36dc264b2df18c839d59bbf91337b3d7bc75ac7999a82f045545a7918d6dc9b015cfe3252a9ce6d59e42bf2ab6ae79ad61843a3589a0d8d3e9d1ec3e337795c99fee36ab6a4d97dd215b0a819dca38cf2a361ff40112d63920c13b5e39a4067104c7a62ddd097bea97ab3c396f12a7eb8cc2b6623aedf43d48213acad1386806e534ac6ea8a1689d3a90a0bb57b4da6b3c9a6b2ca6adb3a88c850d176638532c62a029aad748d8bcb5a202e8abc5f6b4baf957850daa313cf51f669ea710423e72e439a040a62dcafdc8480738c34720bf5789db8ab7df7f406dd6cc964ea1deb4a5a0ff6b3324aa6f3e1fbc79549aecfd3bbbb230c0f27a593ba6625ad425fd60bbdaaef43bb0a0eabcb2a125855257caf27498de5e2c660e3a9da485f74db5abbd331f4ef059bbab2f9973f575f369874353afdaefb1089c4fffa8f76462417f4ccda0dab6bfff14eda8891562f784400450eb170cf55699b60910edb1bc00b65709e37b85a1e88a131889bf042c3c1f6b8974373ba2d6c7b25dafa7ba629b7bfc786dc7bb0794fd8c403aada03b73d7157a4c990ad5511f7c950a03aa65a0f0f2e604766d017b6edfbe778039741af7bfcba765a6baea3a07311f3be4c1be0c941e3addfd6d12aaec8507a23e501d0573ea3573c7f9c177aa6d13047964e0b47a3a8c19ce476b86aca627202415c14c24848e8595d2664f3885180d104080cfe6090d6b478bafc2f5627510aca6cf8504254abfd708797e3e745700879a896d9c2a531644b29bcdae1262a61a0dc0d4b51a55856b7fde447f85c5e2e0a8baa7a0951a5b4477d256877f8e5f027ccf3e5f3e7fdab82eeed7b1b338a58a6ac8749dc2c0ad9b65d918ffcd7a36ca5985c09f0738683314e58564ad9876d32323afed65fa1c8204568ec7918aad13d7d70f4b0a4789fd807b35e4f673ffba084203cd958c55ccdda7616672664aa6c6627bb0a5bebce2e35d1395404eb36b3a3ab1fc4134e97f04d82978e253ed734124de740685a1177f3416dd083ddadacdd7633a6b49e94437488540fb7496a54004eedb3eb1235148f54e15339e15a053ebb63249d1217604a1aabcff0e33c033b5eeb3a0a07c3880a5d119632176ea6b41efec7b9e44b8b5bc5542b6bcc5853fed5133cad1bac58c87a005a8181a48fe1c2b89447e5576f5c866ecd89515f47c81178585bebceca0743173d51385aa49525b3aa7977b57fdd3c0fb10777575b519b8e340d70d223e68d6013edbb52d8b262f89b3b17694d88b562bc3a63d996ab13fda4272c117f630f54785151f3e9d89f2c43ec9d3626647445de0bfc13bd3e0502089f23a7852d1bd64e99a37723a7ccfc89f11235f08afd7ffdc40e8c579ec2fb4c1c04862246ee8ab540a579411e6b4d5e806a85b967e79c6a0c813819d2d7c4d6350b19192cd3b79a0980dd7575d7abc750df1f8aea0ee4aeea0ab51d34d8c0eeffba17bff3a3a9564a0cd2ed09bd3f91e38ec20a9d7ea0697cdeccc286a3cadb6192b891afb1f506aafb098c905589741a17c20fb6af49e4a6dff3d76c0de3aa067022366a62f6db3ff1e1c84897a9c77012aaf3ec596ff9d31b256dd17ebb157a840774faacc456639d8915df4a2315f7299441adc50bf9fccc9f965d3237e7ae0305405926c3710cd6fe887fae68ec866dbc8aaf5c93405d10ff9a1df481f3d95ddbb4bdb95dedd0d8b9837382f8919bc99f80dcd454a9879b250f11de2bfbc7bbecd1a638de2ca3fefb49030b1eca451c78b9fe8560d05fb371721dccbd4cac317aafc20a5d7b868a0b504a6e229b5997189e6a379bc0a815f643cc8defdb59c10c79dfb74a861731eb56e04af7b01cddd546e2cf149cdabdbc836f89618521e53362066364469423e0ddd3aaa8c1659a6a8fb8030693915d985d337bc83bbc7ca56219c20914447a350d4bb3667c81ed7cc355ff54974e0450b0d8bcd979868e9bb7f04bf7ab2c15eae19014305f718958c2a7c7f17d2c99cb7454e710407387f043999ecc5853ded647b89d12218a19b8c0d42329cd342d555a3066193c6ff1ea8088cb6833cc0689107afc73ec0be378c404a3cca4596b8853dc62f55c32a69ed09a5bac0a5538b49863a048a01b7caff40bce8c247bc85261511421d058f4c6e8cc33874ecb2a4c68502183c3d0709492d9cb5a1dd26be62dfa7a004a4239681af3e1640dd329548c52f556e554ea89104d3749c05b56da5376b3a936854d914595ba68340e2a5103125fc3196039e3082bdc5c6766a102472075f1f3be298f5a209ecf5d91068131ec275de3722660e74b4e8cad0686a5a9c58fd6089d831b5f8eaa01f967fcb5f00f1cfe2f6e0ebbe403b6b3fc0817100c0908ef0e0d5d1d8d6e0abc037f6b453be896418657952a3e75e149c7e49466be6c5ee452920fd7189da2d4becb68b8eed3c26de0ea69c57a016fbd1f5ba38cb8c6e959c7af4cd37f7eff6a6e3932b8b07e32f573fb1fadbfc9eaec3b3345bab3add17728cff22a6a8fb3633693063d93ad309bc95bbc7f9b0109cb8bf81992d6eba85c5b150723c8e66b1744415014853cbe3c51621a7eab690a00ed1ec4581983baa6a3bd1b3938eb8f475f0f726be52259b24500d9572b1ad10576e8521c380433e4285627f53d622f562792140a61d4004efe3c83c2d4eec3e95fb8c7c6310871fc0b1766226096f92b1f57c1a91c1e4e23b7e3a6b7f4fd67f6b95c9e285baa707041a9281d8cc12877f203e9b7ccf7e5fb2f1314e11798cb11a6679226273dc6b322f46851f017b2e07d391cab885c0472f20ac3314d76b64e712c1870f23afed02fa5ae3c57e11c791a24fb8d7d7824b0a21898c0d30d2e4ac7a2f9f2d03314860de7e5feb899aaa1f4716a6b5627b90d6beece2e393139585e29c40062dbf748c8bfbf10491e078e2d651da4124897406fba1d9ba57b8dd538bdecc3adb01a63b59191848a1c7cb9d62f78c948541c26b6525785bc4a84e12a407133a7460d7dd59eebba0093f9a3aea21f4514f1f36ec2a29d981c191fc4555190b81f411291f089fb58ba247a899963bc82e48f1e7aa366df4f4c0af33075f1abe505d4776c5263c5a2dafebcd098179e7f1cf5e3bbced99f5c856a272ddad90ddd6eead79cfb7febf6e796295fb2e4ed5103f3c72913c3a2c0e24c8095f37c7103706176475c35efb95c8668c3acb8d8541cfb59656559b9fb9cb374c5ef1eceef9a4693cc187806f17324a4b66a0fff9c9d2eb816bc389db971f79744730f924b4e524d2d25525edcd5b56ffa8f7d46ac0cf1aa53583c2a3af2d0af598a8bcb2221b95b5bcc800679791b2a374ecb6e41385aac95635d6d9c6c5bf30484e41b0307c819b82b3021ed9c6c5e7910426e8ab3d897485d6bca5773ed6b36bec038538d1e615d08c95466816daa0bf2a0d336c0001ff1d2acf86325bd1a6e9981873e5355461797c109dcc823d360d39748b0f2bcba79510d263d8dbbce29cf9dd2d3045497cf9c74e20149872859977404d728a7cc17195c7850ee9eaec33db09a692a5332483a76b64be3d64c03f1e1fe178786fd59a0b982d9cad0a82b8a80612afefa85d92bb7495c5b8bf7c1885c144103aeee72f117b0f12529cab73dcdd55047cecf69f3996ba0de0147ed3f70a8d9433277a0739b8f5dbaaecbab5a06b2e3b222d981d2f506d5bbec33ba1407cdd385752208acc8079703dcd6630eec7eeed2a4d7c9825f1c2c2ff622c0494a0c72ed0003c1aeb213120708c09d297eaa211aa6a73b7d3191b891dfb1f00a44d8e5ec9e92af74b48ee0efb19f4874a7bcb42b0c0e7a88530ef8266a663e2a5ff22481dc84a0d25d61162413aa8a64e66c8f674fc2cc4f2d918899d83073974f5ded8a8413ce73a3aaac3505438a0de1772fcece7f977bb075ba5f1103a953b222d48cf42b4b0f032cd44f469aa677b449ec0d835741ed85918a6652da573ea76f7452992edbbd1db10f138e7be5feef7b3813b08e83c0101433b9c5fd3e281eded9c6babb185627fa3b3e713a87cd8bc0a75d40438003132cddd3853a583cb621921db909a89838b11b42ab33cfc563bd373662689d1bea20b5d5772f1827c2a319d3b77b1bb337239a896b566e8209a99c1b862879d113c3a6be60f90d86cd93892a5449b589140c5b5664f10d8c50d6485820ec204eced06f546b3b18a9a10f6cab07a040757e9d75b94cca3ce90eafdd51052b7e0e525af17ff772e068cee81be0052ec8e04dd3225de44ad9df1cb424ea5e9b404ddde48d83acafb68c71046cb8489c3c3762a8e9ce6cbaca0c93387c915b4ca1448fe36657262d67559826299f1622cc7bb47ec15320e6f0987ef0e4201d87c05d706f808a63dab466bc3f89618b71ef9697f4ec3e74669e2f4870296f2e374c4cb34d12dfbfbd8f44710ddafa87ccfb2b1b249117cd6b2b03a20ff85afd54ddfc03a47a2a51a48c19c8cd79d2bb5cdd89181fc7f969656846146f0de07857ccf9650e74abf4d9cd395e2061fa822a76204f6ab656fb33cecb16347d6b7b44c149c7713ae4906bac11a719b4fec3095260c6e8b4de92e7cff95f2f5e9f66222a76b04effc91d7f5eefd0b6a9ded12ec9b1f2cdd6f336299ab6d48d57eca6e59f07750c9409c75d2542676cca02c09bb11ec5b39ba2a696694e30e2c3a08a0d6da0315332799b9d56496ba9573039995d988748f95f1c101aa25b4f235743cb8a764bbfbfbdbf47a10ddb3407ccf3eb10a4924fdaf557b3af69659c3538a11d89207116d8a06f5ee7e97d3e676deb8606bd983de98d88cde99a03beeb5478489397eaf4de4c6a7479dc1e2a822a70704c2f4d65deb62b4e8874e3149c901c2bc1d05cc17de38088103fd2042d8c6eb4a467289d90a20a3a306f5e67b62544fdd6e32ffdedeb33a2d757cb229be576a0fb3ea2ec5a456d19e7c1007188b79cb4ecfe2a45ffcbed9d6268de04424bcf44305ea896b6e15138cec3cd53285476b413611172ec515aaff8d083ca80f51abaeaf14d219ddad90264d5f296bc8253a528d89744be7caccd8ec3ec17471b1f4e705950b5ff622fc626cff992427d34385046df6ec339d106412af1cb64896be95db38f13741aaec0e4818a80b9c21f430d7b2e066f750bf9c66ec4947f48630eabbf2ae47b1b7bf56f5ee06711f7cf9f0b5ded8815de9fba0029999eca653776237af4d6fc613bc3e4299ec54ad71922fcfca9c6f50ee53caf9a0deb2da49d0e7e404db3a305ddb0e87443e03f2767b3c87bc4549985224117f619979ba068ecea5b6f32f2e4b6a55897f13a309c4ad43d876591e98fb267b4ded345f6b06cc91194bf289fbc7e949bbc169a67a9b7ec21a994013c59d6e0ad3410a8d949dde7429574d3bd6b269a799e40a5f743f12f443f9c5d7e49975d9e61d9d3aa604baec4f46bc1fb4688140e0f5171046a1d489affd96d13a1aaaecc144393915908b3d3a26353c6b4eb239c948406b8eb5dc1b7fd80445ef99d3cc17cd2ec210685e9ade19ec99cf81af7e33c11ae65baf513995a7c3f45d3766bcf5ffafe616c25e25af3a0a77dd10fdeb8b17b3fcc8e6eed13347e26279c926ef75400fb2902ac59d2c0a30c3cf5316b2a6bae95d5a4c345c26d3380406da7e949a3cc313e9fcdcdd74104904fcfd76fca64ee8b18cd50bad6e4804a089efde4438a08c07f6aaabcd3912113a1338fde08a67a4d96b6160c7c3c56eba392ed7624e4da0cd79cf20475011963e10227646621e66da6321995531d59712a013c992d3fff5f7600148e7999d9889fb65943fd2233961a08c363585855101bf793862de741068722c135437a8c9c37f4047402d05bba66291017c3b378562e0e01e6bfb64c0b3dd04a6bc57164e1f72f59f02d75f6e8decba810d6285769fb6f5d396229a1042e8b557450740a62d4da6cd483a1fb60e380a00ee4301c3b29c5168818719b4f121b0eccf05f768c98921dbf6324574719601ca0504ab1f9275cb3a2fb879245c4ecf6b04398dec55591074968163651fe612a882322d95ca10fb2daf75f56220210dbae05a096a4dbf3aea87e6f53560576d4305a5676e4ee79c4f13f541ed37f7794c6257c266d890c55162de7431c2d52ea8b0128aeb446b3295c8b1ee48ba5f99fd3b83df9c1497dbff95bbbf04ddb9666bbb74a03bbc52c7b2a5b36272079b78fcb48e40bbcdd13538ddc7bfd3a020f30201c64f6fcfd30c57747c084b0261c422df49069d100ecc2315698039f25335bf5ea795a6d22c3a07a2e2443d39beb994fda062fd0b7887eccda099cda8d6470f7c98a495c7a6de04945ded96d67e7a00248974cdd7da931b459dce2eb785f1cf76021a6f92b7af3e95c1bab1a80f2b8583be7b250f9c3ebc56f69961f575d877b1431aa5820272dea5a31362f794d8ba0e4c623a76720d9095ed40def66241a72c046e6757b940aafd782f21ed99ec008a07a76f55cd99d3c1d71889bf0426b9b16b897462d6bc08403ea59ca7f2cd50b8fcb43019893ad1e38c626b08a044da3c157b88728626d196ee955503fa95a08f74879538560176ef41be7780397453b5bfcba79510d263a0dba2b53b3d563fb994fd8537a69f9296ff468b8a11a4928411873e7662128d0a674f2e748e60a06883bb9877ccdeeedd9c3ce4029a10c1f6634102a27320b3c2b8ec3c9a0a8591ae5f3697e27937fd4e304b0601c2ec1d0526545e38040f6a394a3377f9052512a86294012fba10a0e9c5b69602162648d8b685045fda9fe02d53de21370d017c4dd9856bc0314aa7fbd10ba5dd04baecf65fc176e6f5a283e8966592317c81cda8624e9fb6a8e61f2a9287c6f7f18abca68140626bd870923aee72a65e3e00eecff4c3ab9c94c73b87371f3821b0eccff9f749fb1021151f496b49f6a822ca2922c23e9bb4b990a8587ea6bcc14dbe693ec97b802a6b3897ebaa62fff999a01e2c22854077ca567f1f4ae645d88ba201550489179f5538a9ff488beeaeed6bae85622ac2e84ea8ec32246ed3c0543c8d949027a2c8abe6629166bc3572012aeccfde3a89d8bc2cee7574c1b32039e2268504a297dbf1d1af9206a010ac489269c3efdd408cd9be7b85ff3a62046409c72ed000558beb38bc11f8e607b273dae8752b50db8df343647ed57bec40d262d37448137ce938eeaeb58abe6b1acbc295f425fc8ca39c1aa72d66a642e2b3cb221c84898eaf91012aaf309539fdc1cd9eaa99c55918ee5b381462304410ec6e4f015a9ac600d58638ff869865202fdbbb62852a8aa5b8cd48123bddbca80da6ac610989d639fdeddb3bd3a2b13b7bab57ba4f3dcd374ad757c933e24b5f7b442e89f2c47248cdf19947dc2e9411237a8974956ea100b5c7cd2eaf323ce01a12699cf239040991f4080d47ecf55e9cd220864c254457ff6826214eba9cad20780395c035c08b359baf0b35ed5ea2390c743c38231229d206cda2163e1049e9535086845cddfdf1048ceb7a519a8ed9c62d5e68dd7438d7958a2948c2062104a6c95e7afd3f89575312dce23b9e3eb126d36601e1ca39a6121ec80dbf578b5698ad4907c7d9e72c153e8b64310a556b0448249617e8bef9dfdd21cdff1a79de7c43fc808701018e9c73a7c081c203be798d04dda67ffd1201771eed5de7ac9b26ff2d61a0c552ece266a0f9bb7ff99ebacb91cc541e6e723598a6d922a19c08e8483f044089796861a662ba0e51850f0c3a0476023baa901f4aed241e7ecb61f6d8df698504243f443bafe803b1810a948bc73104c7deee57ad702ef1d606ae51262f62856331bca074bce863ea04accf3cc82cddfb4073737b234a99bc79419abcc93bbbabfcc1edc0985320dd5a842548ea896d19f43b8edda8ec3c61023ab3bede7454857c5ef6305e3acb5b6297cfb83cf809edb988f7065fa49973f5baf369564353af6fefaa2dafad38f5f7ed62597f4c40cddab6c3616e64f589f657df846b048397690c62d372b642a6514ebc5066d8406f303a2255458c1889bf652c3c766b8974a03becb7773e4db3a77462837bfc317bc7bb62514acb2c3a0837f97303155588b10a2c511e7c043efcee656bf0f28e957fb10147ef97be7780b2741a35bfcba795a61ee4d8db31e23b92c1be0c9416eaddfd247872b43a07ec30501dde7385eb3cc73bf4db66b753fc48cfefc0243ec9eaaf1d53a8bddd9d43a1e3bcab18e020e41a32bd498ba2c081be42e85f16ac406b2f3a4732ece8638ca8c0ec45e885ddc268e43090620f6c6996cff99c6f251e2dd6a3c6f54e37a2ab977d65485f92006f99913ca374ecb21573857bc11167b317136542879e7241b039a64d9bb6a51448178c6589a495dd3cfd3d89f2a03becb7cd3e52b3d9f6113a9094ab8dd0989546d9166fa0bf2a07166c00f4ff932a1db9c45b747cb71e1873c4e35461fd7c102190973d77360af21a222bcb2c95a61ee4c7dbbce29cf962ca5f16d248f96b4ebb6b113389974095cd8f119b248974a1a6fb26945db10f0d8ede79608583aa163e16a5e8bf4ac810fd15094125a28ae352c6b8ecb273b4ab14341076b2bc42822a17c638ae4efff54b0701c9818cf93a2dd8fbc3ea5d6e39a1a1d7828504d6ec874edd8b4f7f8bc9729d0d4897ba1848477c7f174e3209494b8ae0850f283a40c2c57987dba37219ff38402d09dedaaf4a08da9c339b929a2171f49dbb74c51448fcf2a348d3afcb04c9add516250a8c62694a5f063948130baf7a5539090d04d5f44d007f1fb1eb20b50b48e2eac5db7f10c573afeb6d535fb49b9f89648532006df0c5701bcd153f5ad5bb8585b08ab3133a0695af0b02743be4f44e1add7575fba13a83a362ddd6fd3aa24b713903e0e77dba66b256262c5fd0b7ae04dde401818556bc37ddf68717cf5373b565a13062d23a626da3482c8148e74843347a03ce55dbd66d33766b3c9f5f2e89d1f6bc4a81e456628548dd34ad5e8115cda048eddd107330d708d69d647a236f4ac80756c0032495748cd600178c646ba26f0d8882cec772fdee45c4d4a1ffc7fc204ec7385192a402b4c716db6c40264bbb7f8c839d8ebbf9ba854fd7bc49807f8c62d804715fa5e78c7cf1094022768978b7a0ff4856b36fb6d51092af7a7a83ddd929c0e34d61193b13859c08d55ffc0172f5f799a00a8199de8ccf50789fb659a89c8ae84540f9fb8dbb3ea80f51b08da59572726bca4065f9c9ce1c608911e72c017b76057937819ddec943ea2087b5e8d83be05f1f857320122e896457ec1eb757d23a62109c1e7729e80248f989713b0124a80b34ff2394a4b2db45e08922407f17047472a50077c9646bb46f1bf0234cc38ca14b2e0c9a90ffc7aa98486873649269efb501db50be1ede7436a041576a11b6afb130a82ea55e8e32897495c1226840fb107c8c9444e8c16db23762893a5629559e63a1ad90843adb89a08dd3f9f231b6b1be32c1e34f8b3bb75f7ef4f41d3bd6e83ce03bed64d6dbb0b18562892d9c7685835f5f629e17ff65df0ea665d8e020e39ba053650989a7c2be53b332ea38e24dbfe87bb359a3b5cf76da50034ed310fcc246db2119cc6089871a7ba2396187126a349d244e1fb1566bdd9ab6d8ab7fdd6110dcba0989e2466f450d4d2430c1a3b517fc1621acb5d4bb1458f67237ca1e3af16b13a83117dfc31617ff654997c596b54e62f7860d37823789ca9cebea37491068fd7ada99b0e0e433a8ad88bec7b10ab1f755ed5d7b2f4ecda784119c05fdc09c6b8c070c54856bc3810b7f4e56e235b6c215d7b62ec4515150a06633d340f6b4d044eac5095bf45d3aaaec07a0caa8653b98fe1c60deab44ae01e611051e621a9ea38ccfea1178ce55c73b78d7c185e8245e33bb743d317608f656628548ea9aadf1523d3a2647640710ff8ae234ffef940de8db452089483a7f3a0474a19c65c338d13db497f38882cec34598792e309a610aacaac2f119499492a402b41790db36dc09eb2df1cb009dfcde9cb130402ed6cb8e32897418b15a4fa5e713c9cbd5a8548abb11b3a0ff8c4631d26969100d9cb8a295a02ca7887294c7ab76aa66bef2699589db5da4dd0564f7cae865c1d2c03af7843a04bed31482a5b2e0564221b70811e565afa032dbbafd2e968171024f5fb004ddd3252d9ce913ba4563875df92404dd89a13ac705fb34a8ab56782c1094b1e0501f0726fd11854e7ec17915112d1848fe3602fda8af22d2f7627638a0d509bb47b41555cc2a07669bffc8f45b7c05d7a1e15d0ecdabac09d1a1ee950ad2aa046b8874da83a66df42aefb1f29d74b9cb34d1bbfbfb91017a38ddb3a87ccf3eb1b20e11f14455293a07475294b3bf1135d667d78c74e03e99c16369e674f2130717d98389bac39ef999dd4dee59ea8489e2c1af4de4c6dd47c2c1e2a822a7070430014fb3ff62a2e83e1385161f87e35dcd1390c3bc5666dfb456d5927620ad5ee3a862ed013d9821cde97410c71e5e2d46ffdea13a0ed949a0bb3da211070ac88562794f4d85793a07571ff11d4885cd9eb50a7c0dbcb2316ed7c0c592ec481d3aa862aa9f3cf51f1e2a9a105b0a5669332c26a64fd6c96b480721ac11906a8dbb3a03525438a8b1a5cc97f18a891152d90aba36396967e4667e7f5409bca61d890be3c0647a593ba66b25d402792b891191013b7b37a8b4b2a10240a5ae8974c2fd857c2266eca6df425f7c1a8932501142eecca718c6ce618cd3a72181b7e05e6e9ca08c9190c2ff963b3f004dec3904260a5a08a52de67c0e6345b7ca9f04a0e779173af9fbdb6810dcfc608980d8e60bab443eccdca079397e48159fca14a1ce770259f5af4972f70997f13a2ce6bb11ecd83e386fa46602ff920137b8053e22e1caa692ab68d8c3f83014b7e3f969793019a51934e2f4d325b4f2f774c48cc764bbfbfb91f47a3840a5a84ecf33b10a49314eafb2553a4b3285af6aafdfda3a13b4a5e948969c748b0adbb585d8915d037f1fd2e2fe6dff0c3dac11e0aef41c60779e347c381ef50e1fa8f798899fd6a00a95c887b80dcbf662df43decd37afca871648bae2ca03391f428504ee65f98a1e99ee64b4aa303a09ec739bcbd3d17ad82e04bfd359f57560017c1aa0cd6b0112fd9585ec5574bf9b452ce9786d2a8963fda90af18bbaa873c763ae34351702ebebdd191653fb9f3e132cccf224ea76f5b749119da88b5291d1e1c7aff9691628600da3aad931accc74508cd73549fb38b68ac20329c22d6464b336d30d4b401314e977f29cb4c29aac95bad555efb34af651630540dde798b82da7db4114ad4904db6d39fc9a109e5d05a20409a6d84fa5d9bb4948b2393fea2fb6b3c7130415b57441f1100d9553999d4ecfea78114ce8cd4401b2f9ab900a7491064068f57f8c61aaa2459d0a16d7c9e2a53adda6cbd63169fcd510b12fa72350e0780fb73e73bc332f4ea2c56271d1512e896498188c1e85dea81481c9ce5a84bbb3783c72f54266ec62c56a017cf93a620deaecb4cdd131e82c38a866cbb78d85eae33c0747d35ffb104075ba2137b8b53ab2cdeb3e681a76634ea574a1c9cf501124e876f59cd06b186f0966adbeaba5b9009eca44ad739ec294ed5b431a732917443ba5b208225d017ec0d171d301cf5304a27324c72237f38a92100448267e6d888db1d81a9817a6341385d6153eb02aa02e2298aab46ba0ec3383ff73948acd8c65f687ffa89de976c19c8e047c6b086df6c1ba6204fb32790710b0ef4e1e3b060fe208afb55f38854ed6f7864ebf533a25119053fb565f13070e5124c379f5b7ba0b4bd81aa5b356c7f6ec63b68c57cf832216b11250a56900f216177659eb4b2d0efb2ad3fc69ed96e73dcfa065b46663f1f29cb432a7acf0481d5f92bf3150db53ddbca8f5b1ee223c342db509bb445f1fd157ca45d46820f6669112155e631ec1346aeef51e3a07963ccfde33856fabd84d16d3e27471c1f4cf05040765b883c6c7159985b1667ffdd302f143b13d47d28d688b6b8db4d63d9be2595e5cb40951578178e84e09c86d938de9d1951499e7a3e92e953b7692943df662a04a25df560e0915defdbcb63b7aed3c26cab57c9c21a049fb74f575e6a1795ac5e70301cd2654252c7961e7d4533a6f34f6714eb1db35b6aebf69c9c58647de7949629d47d6ed1646d369309a173ad309bc04e7c7d6b0219c20bf3b482d2560bb360fc81e3ecc975ff5cb92625428460964bb2d62175f304a9a13a8a498f9d7d840896b4276fbbb3abbfff5065e948bf6ca7482bb0ef1f6c274dfdfab556a4d5397dea016e849afc9c09c6b3af2da40c77957fb0eb508039e73ac9538f60383eef453660487b62591b1b64ab02e62aeb2173c6a67db94eae93845e72de9cb4562042201ca44cb3a31b2e613579c427e7b2acd32b59f99e090206a62c2846204783fe73ba53e30e2af7cfda062ae850f846b6569b6eeca9cb21668403e9548c542550255a1f517656a577d75a329465ba465b3b0026cc467d2e422f975c317d9efa57600694cd3c1","code":200,"abroad":true}

中间部分好像是加密了还不知是咋的了
最有还有个 "abroad":true

求指导
我在用curl的哪个地方错了

巴扎黑
巴扎黑

membalas semua(2)
迷茫

https://github.com/Mooooooon/Musicoon

小葫芦

跟楼上遇到的问题一样 搜索时获取到的是加密的内容,
settmusic的php代码不知道怎么写?
请大神帮帮忙~~

<?php
$s=empty($_GET['s'])?$_POST['s']:$_GET['s'];
function send_post($url,$post_data){
  $postdata=http_build_query($post_data);
  $options=array(
    'http'=>array(
      'method'=>'POST',
      'header'=>'Referer:http://music.163.com/search/',
      'content'=>$postdata
    )
  );
  $context=stream_context_create($options);
  $result=file_get_contents($url,false,$context);
  return $result;
}
$post_data=array(
  'type'=>'1',
  's'=>$s
);
send_post('http://music.163.com/api/search/get/web?csrf_token=Method=POST',$post_data);

/* $id=''; 取ID的部分还没写;*/

$music=file_get_contents('http://music.163.com/api/song/detail/?id='.$id.'&ids=%5B'.$id.'%5D&csrf_token=Method=GET');
$music=json_decode($music,true);
$music=$music['songs'][0];
$song=$music['name'];
$singer=$music['artists'][0]['name'];
$album=$music['album']['name'];
$url=$music['mp3Url'];
$cover=$music['artists'][0]['picUrl'];
$data=array();
array_push($data,array("song"=>$song,"singer"=>$singer,"album"=>$album,"url"=>$url,"cover"=>$cover));
echo json_encode($data);
?>

在SAE上就可以正常获取数据,在自己的网站上就不可以,PHP是5.3版本的

<?php
$s=empty($_GET['s'])?$_POST['s']:$_GET['s'];
$data=array();
function send_post($url,$post_data){
  $postdata=http_build_query($post_data);
  $options=array(
    'http'=>array(
      'method'=>'POST',
      'header'=>'Referer:http://music.163.com/search/',
      'content'=>$postdata
    )
  );
  $context=stream_context_create($options);
  $result=file_get_contents($url,false,$context);
  return $result;
}
$post_data=array(
  'type'=>'1',
  's'=>$s
);
$result=send_post('http://music.163.com/api/search/get/web?csrf_token=Method=POST',$post_data);
$result=json_decode($result,true);
$result=$result['result']['songs'];
for($i=0;$i<count($result);$i++){
  $id=$result[$i]['id'];
  $music=file_get_contents('http://music.163.com/api/song/detail/?id='.$id.'&ids=%5B'.$id.'%5D&csrf_token=Method=GET');
  $music=json_decode($music,true);
  $music=$music['songs'][0];
  $song=$music['name'];
  $singer=$music['artists'][0]['name'];
  $album=$music['album']['name'];
  $url=$music['mp3Url'];
  $cover=$music['artists'][0]['picUrl'];
  array_push($data,array("song"=>$song,"singer"=>$singer,"album"=>$album,"url"=>$url,"cover"=>$cover));
}
echo json_encode($data);
?>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan