/** * Store a newly created resource in storage. * * @return Response */ public function store_deprecate() { /* if ( is_null($this->api_token) || empty($this->api_token) ){ return Response::json(array('status' => '0', 'message' => 'API toke is required')); } */ Log::info('========== Add new post =========='); $params = Input::all(); /* $photos = ""; foreach ($params['photos'] as $photo) { $photo->move(storage_path().'/tmp', $photo->getClientOriginalName()); $photos = '@'.storage_path().'/tmp/'.$photo->getClientOriginalName(); } */ Log::info('Inputs', $params); $url = 'http://www.candychat.net/ajax.php?t=post&a=new&user_id=' . $this->user->id . "&user_pass="******"&token=" . $this->api_token; //$api_response = cURL::post($url, $params); //Log::info('Result', $api_response->toArray()); $api_response = cURL::newRequest('post', $url, $params)->setHeaders(array('content-type' => 'multipart/form-data'))->send(); $json = json_decode($api_response->body, 1); //echo $api_response; //$response = $params['photos']; if ($json['status'] == 200) { return Response::json(array('status' => '1', 'response_code' => '200', 'debug' => $url)); } else { return Response::json(array('status' => '0', 'response_code' => $json['status'], 'response_body' => $json, 'debug' => $url)); } /* $post = array('timeline_id' => '3082', 'recipient_id' => '', 'text' => 'test', 'soundcloud_title' => '', 'soundcloud_uri' => '', 'youtube_title' => '', 'youtube_description' => '', 'youtube_video_id' => '', 'google_map_name' => '', 'clip_title' => '', 'clip_description' => '', 'photos' => $photos, 'clips' => '', 'ppv_link' => '', 'ppv_thumb' => '', 'ppv_title' => ''); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $result=curl_exec ($ch); curl_close ($ch); */ echo $result; }