קוד לחישוב דקות נכנסות לא עובד
-
@אליהושש כן אבל עכשיו אני מבצע שינוי כך שזה יקח את הנתונים מקובץ אקסל על ידי המרתו למערך כך שאני אוכל להוסיף / להוריד מספרים
-
@קובי-י פנה אלי במייל
-
@אליהושש מעולה הצלחתי להוסיף לולאה כך שזה רץ על קובץ אקסל
-
@אליהושש שלום! שיניתי את זה כך שהמספרי מערכות והסיסמאות יהיו בקובץ 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."; ?>תודה רבה!
-
@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."; ?> -
@אליהושש עבד אבל אז הוספתי אפרשרות לבקשת @קובי-י שיהיה אפשרות להגדיר בשלוחה הגדרה שתגרום לכך שישאל איזה תאריך רוצים לבדוק מצורף הקוד המלא
<?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."; } ?> -
@אליהושש לפי בדיקות שבדקתי הבעיה היא בתאריך כשאני מזין תאריך הוא אומר כמות דקות שגויה אבל כש
'ok!=='okאז עובד מעולה (כש'ok=='okאז לא עובד מהו עם התאריך) -
מישהו יכול לעזור לי
-
@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."; } ?>ואל תשכח לעדכן
-
@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."; ?>
שלום! נראה שהשיחה הזו מעניינת אותך, אבל עדיין אין לך חשבון.
נמאס לכם לגלול בין אותם הפוסטים בכל ביקור? כשנרשמים לחשבון, תמיד תחזרו בדיוק למקום שבו הייתם קודם, ותוכלו לבחור לקבל התראות על תגובות חדשות (בין אם במייל, ובין אם בהתראת פוש). תוכלו גם לשמור סימניות ולפרגן ב-upvote לפוסטים כדי להביע הערכה לחברי קהילה אחרים.
בעזרת התרומה שלך, הפוסט הזה יכול להיות אפילו טוב יותר 💗
הרשמה התחברות