/**
  * Checking Page Url .
  *
  * @return \Illuminate\Http\Response
  */
 public function ajaxUrlChecking(Request $request)
 {
     $id = $request->get('id');
     $action = strtolower(html_entity_decode($request->get('action')));
     /*
      * profile functionality
      */
     if ($action == 'trap.it feed') {
         $content = @file_get_contents($id);
         try {
             $x = new \SimpleXmlElement($content);
         } catch (\Exception $ex) {
             echo 'invalid';
             die;
         }
         if (empty($content)) {
             echo 'invalid';
             die;
         }
         $counter = 0;
         foreach ($x->entry as $entry) {
             if ($entry->link['href'][0]) {
                 $counter++;
             }
         }
         if ($counter > 0) {
             echo 'valid';
         } else {
             echo 'invalid';
         }
         die;
     }
     if ($action == 'rss_feed') {
         $content = @file_get_contents($id);
         if (empty($content)) {
             echo 'invalid';
             die;
         }
         try {
             $x = new \SimpleXmlElement($content);
             if (isset($x->channel->item)) {
                 $counter = 0;
                 foreach ($x->channel->item as $entry) {
                     $counter++;
                 }
                 if ($counter > 0) {
                     echo 'valid';
                 } else {
                     echo 'invalid';
                 }
                 die;
             }
         } catch (\Exception $ex) {
             echo 'invalid';
             die;
         }
     }
     if ($action == 'profile') {
         $get_profile_info = Profile::select()->where('id', $id)->get()->toArray();
         $data_array = array();
         if (empty($get_profile_info)) {
             $get_profile_info = User::select()->where('id', $id)->get()->toArray();
             foreach ($get_profile_info as $key => $val) {
                 $data_array = array('name' => $val['name'], 'url' => $val['homeurl'], 'pic' => "/images/profiles/" . $val['image']);
             }
         } else {
             foreach ($get_profile_info as $key => $val) {
                 $data_array = array('name' => $val['child_name'], 'url' => $val['child_home_url'], 'pic' => "/images/profiles/" . $val['child_pic']);
             }
         }
         echo json_encode($data_array);
     }
 }