• הרשמה
    • התחברות
    • חיפוש
    • דף הבית
    • אינדקס קישורים
    • פוסטים אחרונים
    • קבלת התראות מהדפדפן
    • משתמשים
    • חיפוש בהגדרות המתקדמות
    • חיפוש גוגל בפורום
    • ניהול המערכת
    • ניהול המערכת - שרת private

    קוד לחישוב דקות נכנסות לא עובד

    פורום PHP
    3
    28
    427
    טוען פוסטים נוספים
    • מהישן לחדש
    • מהחדש לישן
    • הכי הרבה הצבעות
    תגובה
    • הגיבו כנושא
    התחברו בכדי לפרסם תגובה
    נושא זה נמחק. רק משתמשים עם הרשאות מתאימות יוכלו לצפות בו.
    • ק
      קובי י. @ivrפון נערך לאחרונה על ידי קובי י.

      @ivrפון
      איך אני יכול להשתמש בדבר כזה גם?
      תודה רבה

      I תגובה 1 תגובה אחרונה תגובה ציטוט 0
      • א
        אליהושש @ivrפון נערך לאחרונה על ידי

        @ivrפון
        זה עובד לך בסוף?!

        I 2 תגובות תגובה אחרונה תגובה ציטוט 1
        • I
          ivrפון מומחה @אליהושש נערך לאחרונה על ידי

          @אליהושש כן אבל עכשיו אני מבצע שינוי כך שזה יקח את הנתונים מקובץ אקסל על ידי המרתו למערך כך שאני אוכל להוסיף / להוריד מספרים

          תגובה 1 תגובה אחרונה תגובה ציטוט 2
          • I
            ivrפון מומחה @קובי י. נערך לאחרונה על ידי

            @קובי-י פנה אלי במייל

            תגובה 1 תגובה אחרונה תגובה ציטוט 1
            • I
              ivrפון מומחה @אליהושש נערך לאחרונה על ידי

              @אליהושש מעולה הצלחתי להוסיף לולאה כך שזה רץ על קובץ אקסל

              תגובה 1 תגובה אחרונה תגובה ציטוט 2
              • I
                ivrפון מומחה @אליהושש נערך לאחרונה על ידי ivrפון

                @אליהושש שלום! שיניתי את זה כך שהמספרי מערכות והסיסמאות יהיו בקובץ ini ואז זה הופך למערך אבל זה לא עובד
                (שיניתי בשביל @קובי-י ) הקוד החדש:

                <?php
                $password= $_GET['password'];
                $ApiExtension=$_GET['ApiExtension'];
                
                
                if ($password == null) {
                    print "id_list_message=t-לא הוגדרה סיסמה.";
                    exit();
                }
                $ui=file_get_contents("https://www.call2all.co.il/ym/api/GetTextFile?token=$ApiDID:$password&what=ivr2:$ApiExtension/did.ini");
                $data = json_decode($ui, true);
                
                // הקצאת הערך של "contents" למשתנה text
                $text = $data['contents'];
                $the_big_array= explode("\r\n", $text);
                $uy = 0; /
                
                foreach ($the_big_array as $token) {
                    list($did, $pass) = explode("=", $token, 2);
                    $url = "https://www.call2all.co.il/ym/api/GetIncomingSum?token=" . $did . ":$pass";
                    $json = json_decode(file_get_contents($url), true);
                
                    $direct = $json['direct'];
                    $transferIn = $json['transferIn'];
                    $transferOut = $json['transferOut'];
                
                    $direct2 = (int)substr($direct, 0, strpos($direct, "."));
                    $transferIn2 = (int)substr($transferIn, 0, strpos($transferIn, "."));
                    $transferOut2 = (int)substr($transferOut, 0, strpos($transferOut, "."));
                
                    $txt1 = $direct2 + $transferIn2;
                    $txt2 = $txt1 - $transferOut2;
                    $uy += $txt2;
                }
                print "id_list_message=t-הדקות הם.n-$uy.";
                ?>
                

                תודה רבה!

                א תגובה 1 תגובה אחרונה תגובה ציטוט 2
                • א
                  אליהושש @ivrפון נערך לאחרונה על ידי אליהושש

                  @ivrפון
                  היו כמה באגים, הנה קוד שאמור לעבוד, תעדכן על רמת תקינותו

                  <?php
                  $ApiDID=$_GET['ApiDID'];
                  $password=$_GET['password'];
                  $ApiExtension=$_GET['ApiExtension'];
                   
                  if ($password == null || $ApiDID== null || $ApiExtension== null) {
                      print "id_list_message=t-לא הוגדרו כל המשתנים.";
                      exit();
                  }
                  
                  $ui=file_get_contents("https://www.call2all.co.il/ym/api/GetTextFile?token={$ApiDID}:{$password}&what=ivr2:{$ApiExtension}/did.ini");
                  $data = json_decode($ui, true);
                   
                  $text = $data['contents'];
                  $the_big_array= explode("\n", $text);
                  $uy=0;
                  
                  foreach ($the_big_array as $token) {
                      list($did, $pass) = explode("=", $token, 2);
                      $url = "https://www.call2all.co.il/ym/api/GetIncomingSum?token={$did}:{$pass}";
                      $json = json_decode(file_get_contents($url), true);
                   
                      $direct = $json['direct'];
                      $transferIn = $json['transferIn'];
                      $transferOut = $json['transferOut'];
                   
                      $direct2=(int)substr($direct, 0, strpos($direct, "."));
                      $transferIn2=(int)substr($transferIn, 0, strpos($transferIn, "."));
                      $transferOut2=(int)substr($transferOut, 0, strpos($transferOut, "."));
                  
                      $txt1=$direct2+$transferIn2;
                      $txt2=$txt1-$transferOut2;
                      $uy=$uy+$txt2;
                  }
                  print "id_list_message=t-הדקות הם.n-$uy.";
                  ?>
                  
                  
                  I 3 תגובות תגובה אחרונה תגובה ציטוט 3
                  • I
                    ivrפון מומחה @אליהושש נערך לאחרונה על ידי ivrפון

                    @אליהושש עבד אבל אז הוספתי אפרשרות לבקשת @קובי-י שיהיה אפשרות להגדיר בשלוחה הגדרה שתגרום לכך שישאל איזה תאריך רוצים לבדוק מצורף הקוד המלא

                    <?php
                    $ok=$_GET['ok'];
                    $ApiDID=$_GET['ApiDID'];
                    $password=$_GET['password'];
                    $ApiExtension=$_GET['ApiExtension'];
                     $from=$_GET['from'];
                      $to=$_GET['to'];
                     if($ok==null){
                    $ui=file_get_contents("https://www.call2all.co.il/ym/api/GetTextFile?token={$ApiDID}:{$password}&what=ivr2:{$ApiExtension}/did.ini");
                    $data = json_decode($ui, true);
                     
                    $text = $data['contents'];
                    $the_big_array= explode("\n", $text);
                    $uy=0;
                     
                    foreach ($the_big_array as $token) {
                        list($did, $pass) = explode("=", $token, 2);
                        $url = "https://www.call2all.co.il/ym/api/GetIncomingSum?token={$did}:{$pass}";
                        $json = json_decode(file_get_contents($url), true);
                     
                        $direct = $json['direct'];
                        $transferIn = $json['transferIn'];
                        $transferOut = $json['transferOut'];
                     
                        $direct2=(int)substr($direct, 0, strpos($direct, "."));
                        $transferIn2=(int)substr($transferIn, 0, strpos($transferIn, "."));
                        $transferOut2=(int)substr($transferOut, 0, strpos($transferOut, "."));
                     
                        $txt1=$direct2+$transferIn2;
                        $txt2=$txt1-$transferOut2;
                        $uy=$uy+$txt2;
                    }
                    print "id_list_message=t-הדקות הם.n-$uy.";
                    }
                    
                    elseif($ok=='ok'){
                        if($from==null){print"read=t-אנה בחר תאריך ממנו יבדוק ב.n-8.t-ספרות שנה יום וחודש.=from,,8,8,,No,,
                        ";exit();}
                    elseif($to==null){print"read=t-אנה בחר תאריך שעד אז יבדוק ב.n-8.t-ספרות שנה יום וחודש.=to,,8,8,,No,,
                        ";exit();}
                        $formatted_date = substr($to, 0, 4) . '-' . substr($to, 4, 2) . '-' . substr($to, 6, 2);
                        $formatted_date2 = substr($from, 0, 4) . '-' . substr($from, 4, 2) . '-' . substr($from, 6, 2);
                        $ui=file_get_contents("https://www.call2all.co.il/ym/api/GetTextFile?token={$ApiDID}:{$password}&what=ivr2:{$ApiExtension}/did.ini");
                    $data = json_decode($ui, true);
                     
                    $text = $data['contents'];
                    $the_big_array= explode("\n", $text);
                    $uy=0;
                    foreach ($the_big_array as $token) {
                        list($did, $pass) = explode("=", $token, 2);
                        $url = "https://www.call2all.co.il/ym/api/GetIncomingSum?token={$did}:{$pass}&to=$formatted_date&from=$formatted_date2";
                        $json = json_decode(file_get_contents($url), true);
                     
                        $direct = $json['direct'];
                        $transferIn = $json['transferIn'];
                        $transferOut = $json['transferOut'];
                     
                        $direct2=(int)substr($direct, 0, strpos($direct, "."));
                        $transferIn2=(int)substr($transferIn, 0, strpos($transferIn, "."));
                        $transferOut2=(int)substr($transferOut, 0, strpos($transferOut, "."));
                     
                        $txt1=$direct2+$transferIn2;
                        $txt2=$txt1-$transferOut2;
                        $uy=$uy+$txt2;
                    }
                    print "id_list_message=t-הדקות הם.n-$uy.";
                    }
                    ?>
                    
                    תגובה 1 תגובה אחרונה תגובה ציטוט 3
                    • I
                      ivrפון מומחה @אליהושש נערך לאחרונה על ידי

                      @אליהושש לפי בדיקות שבדקתי הבעיה היא בתאריך כשאני מזין תאריך הוא אומר כמות דקות שגויה אבל כש'ok!=='ok אז עובד מעולה (כש 'ok=='ok אז לא עובד מהו עם התאריך)

                      תגובה 1 תגובה אחרונה תגובה ציטוט 2
                      • I
                        ivrפון מומחה @אליהושש נערך לאחרונה על ידי

                        מישהו יכול לעזור לי

                        א 2 תגובות תגובה אחרונה תגובה ציטוט 3
                        • א
                          אליהושש @ivrפון נערך לאחרונה על ידי אליהושש

                          @ivrפון
                          תנסה את זה

                          <?php
                          $ok=$_GET['ok'];
                          $ApiDID=$_GET['ApiDID'];
                          $password=$_GET['password'];
                          $ApiExtension=$_GET['ApiExtension'];
                           $from=$_GET['from'];
                            $to=$_GET['to'];
                           if($ok==null){
                          $ui=file_get_contents("https://www.call2all.co.il/ym/api/GetTextFile?token={$ApiDID}:{$password}&what=ivr2:{$ApiExtension}/did.ini");
                          $data = json_decode($ui, true);
                           
                          $text = $data['contents'];
                          $the_big_array= explode("\n", $text);
                          $uy=0;
                           
                          foreach ($the_big_array as $token) {
                              list($did, $pass) = explode("=", $token, 2);
                              $url = "https://www.call2all.co.il/ym/api/GetIncomingSum?token={$did}:{$pass}";
                              $json = json_decode(file_get_contents($url), true);
                           
                              $direct = $json['direct'];
                              $transferIn = $json['transferIn'];
                              $transferOut = $json['transferOut'];
                           
                              $direct2=(int)substr($direct, 0, strpos($direct, "."));
                              $transferIn2=(int)substr($transferIn, 0, strpos($transferIn, "."));
                              $transferOut2=(int)substr($transferOut, 0, strpos($transferOut, "."));
                           
                              $txt1=$direct2+$transferIn2;
                              $txt2=$txt1-$transferOut2;
                              $uy=$uy+$txt2;
                          }
                          print "id_list_message=t-הדקות הם.n-$uy.";
                          }
                           
                          elseif($ok=="ok"){
                              if($from==null){print"read=t-אנה בחר תאריך ממנו יבדוק ב.n-8.t-ספרות שנה יום וחודש.=from,,8,8,,No,,
                              ";exit();}
                          elseif($to==null){print"read=t-אנה בחר תאריך שעד אז יבדוק ב.n-8.t-ספרות שנה יום וחודש.=to,,8,8,,No,,
                              ";exit();}
                          $from1 = mb_substr($from, 0, 4, "UTF-8");
                              $from2 = mb_substr($from, 4, 2, "UTF-8");
                              $from3 = mb_substr($from, 6, 2, "UTF-8");
                              $to1 = mb_substr($to, 0, 4, "UTF-8");
                              $to2 = mb_substr($to, 4, 2, "UTF-8");
                              $to3 = mb_substr($to, 6, 2, "UTF-8");
                              $from4="{$from1}-{$from2}-{$from3}";
                              $to4="{$to1}-{$to2}-{$to3}";  
                            $ui=file_get_contents("https://www.call2all.co.il/ym/api/GetTextFile?token={$ApiDID}:{$password}&what=ivr2:{$ApiExtension}/did.ini");
                          $data = json_decode($ui, true);
                           
                          $text = $data['contents'];
                          $the_big_array= explode("\n", $text);
                          $uy=0;
                          foreach ($the_big_array as $token) {
                              list($did, $pass) = explode("=", $token, 2);
                              $url = "https://www.call2all.co.il/ym/api/GetIncomingSum?token={$did}:{$pass}&from={$from4}&to={$to4}";
                              $json = json_decode(file_get_contents($url), true);
                           
                              $direct = $json['direct'];
                              $transferIn = $json['transferIn'];
                              $transferOut = $json['transferOut'];
                           
                              $direct2=(int)substr($direct, 0, strpos($direct, "."));
                              $transferIn2=(int)substr($transferIn, 0, strpos($transferIn, "."));
                              $transferOut2=(int)substr($transferOut, 0, strpos($transferOut, "."));
                           
                              $txt1=$direct2+$transferIn2;
                              $txt2=$txt1-$transferOut2;
                              $uy=$uy+$txt2;
                          }
                          print "id_list_message=t-הדקות הם.n-$uy.";
                          }
                          ?>
                          
                          

                          ואל תשכח לעדכן

                          תגובה 1 תגובה אחרונה תגובה ציטוט 1
                          • א
                            אליהושש @ivrפון נערך לאחרונה על ידי אליהושש

                            @ivrפון
                            ואם אתה רוצה, להלן קוד קצר בהרבה ומדוייק יותר(, מוריד את מה שאחרי הנקודה רק לאחר צירוף הדקות הנכנסות בחיוג ישיר ובמעבר ממערכת אחרת).

                            <?php
                            $ok=$_GET['ok'];
                            $ApiDID=$_GET['ApiDID'];
                            $password=$_GET['password'];
                            $ApiExtension=$_GET['ApiExtension'];
                            $from=$_GET['from'];
                            $to=$_GET['to'];
                             if($ok=="ok"){
                                if($from==null){
                            print"read=t-אנה בחר תאריך ממנו יבדוק ב.n-8.t-ספרות שנה יום וחודש.=from,,8,8,,No,,";
                            exit();
                            }
                            elseif($to==null){
                            print"read=t-אנה בחר תאריך שעד אז יבדוק ב.n-8.t-ספרות שנה יום וחודש.=to,,8,8,,No,,";
                                exit();
                            }
                            $from1 = mb_substr($from, 0, 4, "UTF-8");
                                $from2 = mb_substr($from, 4, 2, "UTF-8");
                                $from3 = mb_substr($from, 6, 2, "UTF-8");
                                $to1 = mb_substr($to, 0, 4, "UTF-8");
                                $to2 = mb_substr($to, 4, 2, "UTF-8");
                                $to3 = mb_substr($to, 6, 2, "UTF-8");
                                $from4="{$from1}-{$from2}-{$from3}";
                                $to4="{$to1}-{$to2}-{$to3}";
                                $fromto="&from={$from4}&to={$to4}";
                            }
                            $ui=file_get_contents("https://www.call2all.co.il/ym/api/GetTextFile?token={$ApiDID}:{$password}&what=ivr2:{$ApiExtension}/did.ini");
                            $data = json_decode($ui, true);
                             
                            $text = $data['contents'];
                            $the_big_array= explode("\n", $text);
                            $uy=0;
                             
                            foreach ($the_big_array as $token) {
                                list($did, $pass) = explode("=", $token, 2);
                                $url = "https://www.call2all.co.il/ym/api/GetIncomingSum?token={$did}:{$pass}{$fromto}";
                                $json = json_decode(file_get_contents($url), true);
                             
                                $direct = $json['direct'];
                                $transferIn = $json['transferIn'];
                                $transferOut = $json['transferOut'];
                             
                                $txt1=$direct+$transferIn;
                                $txt2=$txt1-$transferOut;
                                $uy=$uy+$txt2;
                            
                            }
                            $uy=(int)substr($uy, 0, strpos($uy, "."));
                             
                            print "id_list_message=t-הדקות הם.n-$uy.";
                            
                            ?>
                             
                            
                            
                            תגובה 1 תגובה אחרונה תגובה ציטוט 1
                            • פוסט ראשון
                              פוסט אחרון