Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

In $iptv it has two ids e.g(1,2) coming from database and these ids fetching url form 'server url' table. so when run the code it hit only first id url with the data but not hiting the second id url.

         `````````````````````````````````         
         }elseif ($select_type == 'iptv') {
                        $sql=$sql="SELECT * FROM `main_partner` WHERE `id`='$partner_id'";
                          $result= myQuery($sql);
                          while($row= myFetchArray($result)){
                            $iptv=$row['cspiptv'];
                            $iptv54=explode(",",$iptv);

                         foreach ($iptv54 as $value){
                          
                              if($value != 0){
                                 $sql1="SELECT * FROM `server_url` WHERE `given_id`='$iptv'";
                                 $result1= myQuery($sql1);

                                  while($row1= myFetchArray($result1)){
                                 
                                      $url=$row1['url'];
                                  
                                     $url1=$url."data.php?login=".$login."&password=".$password."&expire=".$expire_date."&user_mode=".$user_mode."&mac_id=".$mac."&iptv=".$enable."&bouquet_ids=".$bonguet_id;  
                                  
                                           header('location:'.$url1); 
                                      
                                  }
                                 
                                }
                                 
                              }
                              
                         } 
                          

                       }
question from:https://stackoverflow.com/questions/66047082/how-to-hit-link-through-array-values

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
125 views
Welcome To Ask or Share your Answers For Others

1 Answer

                     elseif ($select_type == 'iptv') {
                        $sql="SELECT * FROM `main_partner` WHERE `id`='$partner_id'";
                          $result= myQuery($sql);
                          while($row= myFetchArray($result)){
                            $iptv=$row['cspiptv'];
                            $iptv54=explode(",",$iptv);
                           
                            $array = array();

                         foreach ($iptv54 as $value){
                          
                              if($value != 0){
                                 $sql1="SELECT * FROM `server_url` WHERE `given_id`='$value'";
                                 $result1= myQuery($sql1);
                      
                                   while($row1= myFetchArray($result1)){
                                 
                                     $url=$row1['url'];
                                     $url1=$url."data.php?login=".$login."&password=".$password."&expire=".$expire_date."&user_mode=".$user_mode."&mac_id=".$mac."&iptv=".$enable."&bouquet_ids=".$bonguet_id;  
                                    
                                    array_push($array,$url1);
                                    
                                   }
                                }  
                              }
                              
                              $result = getResult($array);
                         } 
                          

                       }
function callCURL($url) {
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  $combined = curl_exec ($ch);
  curl_close ($ch);
  return $combined;
}

function getResult($urls) {
 
  $return = array();

  foreach ($urls as $url) {
  
      $response = callCURL($url);
      if (strlen($response) !== 0) {
          $return[] = $response;
          break;
      }
  }
  return $return;
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...