当我在声音云上传歌曲时,我收到了一个错误

时间:2016-09-02 14:15:16

标签: php amazon-ec2 upload

我正在尝试使用以下与Godaddy正常工作的代码从管理面板上传Soundcloud上的歌曲。我的歌曲成功地加入了soundcloud。从AWS ec2服务器执行时,相同的代码会给我一个错误。我收到了以下错误:

HTTP/1.1 100 Continue

HTTP/1.1 422 Unprocessable Entity
Access-Control-Allow-Headers: Accept, Authorization, Content-Type, Origin
Access-Control-Allow-Methods: GET, PUT, POST, DELETE
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Date
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
Date: Fri, 02 Sep 2016 12:29:40 GMT
Server: am/2
Status: 422 Unprocessable Entity
Content-Length: 142

我正在使用以下代码:

 $soundcloud = new Services_Soundcloud($clientId, $clientSecret, 'your_call_backurl');
               $access_token = getToken();
               $soundcloud->setAccessToken($access_token);
               //$tracks = json_decode($soundcloud->get('me/tracks'), true);

               if($files_arr['audio_img']['error'] == 0){
                   $mytrack = array(
                       'track[title]' => $post_arr['audio_title'],
                       'track[asset_data]' => '@'.$files_arr['audio_file']['tmp_name'],
                       'track[artwork_data]' => '@'.$files_arr['audio_img']['tmp_name'],
                       'track[sharing]' => 'public'
                   );
               }else{
                   $mytrack = array(
                       'track[title]' => $post_arr['audio_title'],
                       'track[asset_data]' => '@'.$files_arr['audio_file']['tmp_name'],
                       'track[sharing]' => 'public'
                   );
               }
               //echo "<pre>";print_r($mytrack);exit;
               $track = json_decode($soundcloud->post('tracks', $mytrack,array(CURLOPT_SSL_VERIFYPEER => false,CURLOPT_SSL_VERIFYHOST => false)),true);
               //echo "<pre>";print_r($track);exit;
               $query_arr = array();
               $query_arr['audio_name'] = $post_arr['audio_title'];
               $query_arr['audio_url'] = $track['stream_url']."?client_id=".$clientId;
               $query_arr['track_id'] = $track['id'];
               date_default_timezone_set('UTC');
               $query_arr['added_at'] = date("Y-m-d H:i:s");
               if($post_arr['show_div'] == 1 && $post_arr['audio_album'] != ""){
                   $query_arr['album_id'] = $post_arr['audio_album'];
               }
               $id = insert('audio',$query_arr);

0 个答案:

没有答案