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

    עזרה בהוספת זיהוי ספיישל ב api

    פורום מפתחים API
    7
    23
    732
    טוען פוסטים נוספים
    • מהישן לחדש
    • מהחדש לישן
    • הכי הרבה הצבעות
    תגובה
    • הגיבו כנושא
    התחברו בכדי לפרסם תגובה
    נושא זה נמחק. רק משתמשים עם הרשאות מתאימות יוכלו לצפות בו.
    • M
      myrmyr נערך לאחרונה על ידי myrmyr

         $add_phone = $con -> connecting('ValidationCallerId',
         [
          'token' =>$token,
      	'action'=> 'send',
      	     [
      	     'callerid' => '0123456789'
      	     'validType' => "call";
            	]
      		
         ]
      );
      print_r($add_phone); 
      

      @MGM-IVR
      יש לי שגיאה בסגירה של הפרמטר האחרון
      (validtype )
      תודה מראש לכל העוזרים

      שמואל M ע 3 תגובות תגובה אחרונה תגובה ציטוט 0
      • שמואל
        שמואל @myrmyr נערך לאחרונה על ידי

        @myrmyr זה צריך להיות אותיות גדולות

        לפניות בנוגע לפורום: shmuel@yemot.co.il

        M תגובה 1 תגובה אחרונה תגובה ציטוט 0
        • M
          myrmyr @שמואל נערך לאחרונה על ידי

          @שמואל כתבתי באותיות גדולות עגם לא עזר...

          M תגובה 1 תגובה אחרונה תגובה ציטוט 0
          • M
            myrmyr @myrmyr נערך לאחרונה על ידי myrmyr

            @שמואל זה השגיאה:

            Parse error: syntax error, unexpected single-quoted string "validType", expecting "]" in C:\xampp\htdocs\test\abc.php on line 260
            

            המבנה אבל בנוי נכון?
            זה PHPהראשון שכתבתי
            חוץ מ שלום עולם....

            תגובה 1 תגובה אחרונה תגובה ציטוט 0
            • M
              MGM IVR מומחה @myrmyr נערך לאחרונה על ידי

              @myrmyr אמר בעזרה בהוספת זיהוי ספיישל ב api:

                 $add_phone = $con -> connecting('ValidationCallerId',
                 [
                  'token' =>$token,
              	'action'=> 'send',
              	     [
              	     'callerid' => '0123456789'
              	     'validType' => "call";
                    	]
              		
                 ]
              );
              print_r($add_phone); 
              

              @MGM-IVR
              יש לי שגיאה בסגירה של הפרמטר האחרון
              (validtype )
              תודה מראש לכל העוזרים

              אתה עובד עם ספריה כלשהיא?

              M תגובה 1 תגובה אחרונה תגובה ציטוט 1
              • M
                myrmyr @MGM IVR נערך לאחרונה על ידי myrmyr

                @MGM-IVR
                מה הכוונה?

                M תגובה 1 תגובה אחרונה תגובה ציטוט 0
                • M
                  MGM IVR מומחה @myrmyr נערך לאחרונה על ידי

                  @myrmyr אמר בעזרה בהוספת זיהוי ספיישל ב api:

                  @MGM-IVR
                  מה הכוונה?

                  אין כאן מקום להאריך מה זה ספריה,
                  אבל אשאל שאלות כדי להבין את הבעיה,
                  זה כל הקוד?
                  או שיש עוד חלקים?
                  מי אמר לך לכתוב את מה שכתבת?
                  מאיפה זה?

                  M תגובה 1 תגובה אחרונה תגובה ציטוט 0
                  • ע
                    ערוץ הסקרים @myrmyr נערך לאחרונה על ידי

                    @myrmyr אמר בעזרה בהוספת זיהוי ספיישל ב api:

                       $add_phone = $con -> connecting('ValidationCallerId',
                       [
                        'token' =>$token,
                    	'action'=> 'send',
                    	     [
                    	     'callerid' => '0123456789'
                    	     'validType' => "call";
                          	]
                    		
                       ]
                    );
                    print_r($add_phone); 
                    

                    לא כתבת תקין את המערך,
                    מה זה הנקודה פסיק אחרי הערך של validType, ולמה אין פסיק אחרי הערך של callerid?

                    M תגובה 1 תגובה אחרונה תגובה ציטוט 2
                    • M
                      myrmyr @MGM IVR נערך לאחרונה על ידי

                      @MGM-IVR עשיתי לפי המדריך הזה:
                      https://f2.freeivr.co.il/topic/6918/מדריך-התחלת-עבודה-עם-api-של-ימות-משיח-חלק-ג?_=1661863941976

                      וכמובן שיש את החלק של ההתחברות של המערכת, ואת המחלקה....

                      תגובה 1 תגובה אחרונה תגובה ציטוט 0
                      • M
                        myrmyr @ערוץ הסקרים נערך לאחרונה על ידי

                        @ערוץ-הסקרים
                        תיקנת כמו שכתבת ועדיין יש לי את השגיאה הבאה:

                        hello
                        Warning: Array to string conversion in C:\xampp\htdocs\test\abc.php on line 21
                        stdClass Object ( [responseStatus] => Exception [yAfastVersion] => 6.1.18 [message] => Missing parameters [parameter] => callerId )
                        
                        אהרן שובקס תגובה 1 תגובה אחרונה תגובה ציטוט 0
                        • אהרן שובקס
                          אהרן שובקס ניהול @myrmyr נערך לאחרונה על ידי

                          @myrmyr אמר בעזרה בהוספת זיהוי ספיישל ב api:

                          callerId

                          צריך לכתוב ככה callerId ולא callerid

                          M תגובה 1 תגובה אחרונה תגובה ציטוט 0
                          • M
                            myrmyr @אהרן שובקס נערך לאחרונה על ידי

                            @אהרן-שובקס אותה שגיאה...

                            אהרן שובקס תגובה 1 תגובה אחרונה תגובה ציטוט 0
                            • אהרן שובקס
                              אהרן שובקס ניהול @myrmyr נערך לאחרונה על ידי

                              @myrmyr אמר בעזרה בהוספת זיהוי ספיישל ב api:

                              @אהרן-שובקס אותה שגיאה...

                              שלח את כל הקוד שכתבת

                              M תגובה 1 תגובה אחרונה תגובה ציטוט 0
                              • M
                                myrmyr @אהרן שובקס נערך לאחרונה על ידי

                                @אהרן-שובקס

                                <?php 
                                define("URL", "https://www.call2all.co.il/ym/api/");
                                $server = "www";
                                
                                class BodyPost
                                {
                                // part "multipart/form-data"
                                    public static function PartPost($name, $val)
                                     {
                                         $body = 'Content-Disposition: form-data; name="' . $name . '"';
                                // check instance of oFile
                                         if($val instanceof oFile)
                                          {
                                              $file = $val->Name();
                                              $mime = $val->Mime();
                                              $cont = $val->Content();
                                 
                                              $body .= '; filename="' . $file . '"' . "\r\n";
                                              $body .= 'Content-Type: ' . $mime ."\r\n\r\n";
                                              $body .= $cont."\r\n";
                                          } else $body .= "\r\n\r\n".$val."\r\n";
                                         return $body;
                                     }
                                 
                                    public static function Get(array $post, $delimiter = '-------------0123456789')
                                     {
                                         if(is_array($post) && !empty($post))
                                          {
                                              $bool = true;
                                              //foreach($post as $val) if($val instanceof oFile) {$bool = true; break; };
                                              if($bool)
                                               {
                                                   $ret = '';
                                                   foreach($post as $name=>$val)
                                                       $ret .= '--' . $delimiter. "\r\n". self::PartPost($name, $val);
                                                   $ret .= "--" . $delimiter . "--\r\n";
                                               } else $ret = http_build_query($post);
                                          } else throw new \Exception('Error input param!');
                                         return $ret;
                                     }
                                }
                                 
                                class oFile
                                {
                                     private $name;
                                     private $mime;
                                     private $content;
                                 
                                     public function __construct($name, $mime=null, $content=null)
                                      {
                                          if(is_null($content))
                                           {
                                               $info = pathinfo($name);
                                // check is exist and readable file
                                               if(!empty($info['basename']) && is_readable($name))
                                                {
                                                    $this->name = $info['basename'];
                                // get MIME
                                                    $this->mime = mime_content_type($name);
                                // load file
                                                    $content = file_get_contents($name);
                                                    if($content!==false)
                                                    {
                                                        $this->content = $content;
                                                    }
                                                    else
                                                    {
                                                        throw new Exception('Don`t get content - "'.$name.'"');
                                                    }
                                                }
                                                else
                                                {
                                                    throw new Exception('Error param');
                                                }
                                           }
                                           else
                                           {
                                                   $this->name = $name;
                                                   if(is_null($mime)) $mime = mime_content_type($name);
                                                   $this->mime = $mime;
                                                   $this->content = $content;
                                            };
                                      }
                                 
                                    public function Name() { return $this->name; }
                                 
                                    public function Mime() { return $this->mime; }
                                 
                                    public function Content() { return $this->content; }
                                 
                                }
                                 
                                class connecting_to_yemot_api
                                {
                                    public $token;
                                 
                                    const URL = URL;
                                 
                                    public function __construct($user_name, $password)
                                    {
                                        $body = array('username' => $user_name, 'password' => $password);
                                 
                                        $body = http_build_query($body);
                                 
                                        $opts = array('http' => array(
                                 
                                            'method'  => 'POST',
                                 
                                            'header'  => "Content-Type: application/x-www-form-urlencoded",
                                 
                                            'content' => $body,
                                 
                                            'follow_location' => false) );
                                 
                                         $context  = stream_context_create($opts);
                                 
                                         $url = self::URL.'Login';
                                 
                                            $result = file_get_contents($url, FALSE, $context);
                                 
                                            $result = json_decode($result);
                                 
                                            if($result -> responseStatus == 'OK')
                                            {
                                                $this -> token = $result -> token;
                                 
                                                return TRUE;
                                            }
                                            else
                                            {
                                                throw new Exception('שם המשתמש או הסיסמא של המערכת שגויים');
                                            }
                                    }
                                 
                                    public function __destruct()
                                    {
                                        $this -> connecting('Logout');
                                    }
                                 
                                    public function connecting($action, $body = array())
                                    {
                                        $delimiter = '----'.uniqid();
                                 
                                        $body['token'] = $this -> token;
                                 
                                        $body = BodyPost::Get($body, $delimiter);
                                 
                                        $opts = array('http' =>
                                                array(
                                                    'method'  => 'POST',
                                                    'header'  => 'Content-Type: multipart/form-data; boundary='.$delimiter,
                                                    'content' => $body,
                                                    'follow_location' => false
                                                    )
                                                  );
                                        $context  = stream_context_create($opts);
                                 
                                        $url = self::URL.$action;
                                 
                                        $result = file_get_contents($url, FALSE, $context);
                                 
                                        $headers = $this -> parseHeaders($http_response_header);
                                 
                                        if($headers['Content-Type'][0] == 'application/json')
                                        {
                                            return json_decode($result);
                                        }
                                        else
                                        {
                                            return $result;
                                        }
                                    }
                                 
                                    private function parseHeaders($headers)
                                    {
                                        // פונקציה שמקבלת מערך של שורות הכותרות
                                        // הפונקציה מפרקת את קבצי הקוקי לתת-מערך נפרד
                                 
                                 
                                        // מערך הכותרות
                                        $head = array();
                                 
                                        foreach( $headers as $k=>$v )
                                        {
                                            $t = explode( ':', $v, 2 );
                                 
                                            if( isset( $t[1] ) )
                                            {
                                                if($t[0] == 'Set-Cookie')
                                                {
                                                    $CookiesArr = array();
                                 
                                                    $cookies = explode( ';', $t[1]);
                                 
                                                    foreach($cookies as $cookie)
                                                    {
                                                        $c = explode( '=', $cookie);
                                 
                                                        if( isset( $c[1] ) )
                                                        {
                                                            $CookiesArr[ trim($c[0]) ] = trim( $c[1] );
                                                        }
                                                        else
                                                        {
                                                            $CookiesArr[] = trim( $c[0] );
                                                        }
                                                    }
                                 
                                                    $head[ trim($t[0]) ] = $CookiesArr;
                                                }
                                                elseif($t[0] == 'Content-Type')
                                                {
                                                    $arr = array();
                                 
                                                    $children = explode( ';', $t[1]);
                                 
                                                    foreach($children as $child)
                                                    {
                                                        $c = explode( '=', $child);
                                 
                                                        if( isset( $c[1] ) )
                                                        {
                                                            $arr[ trim($c[0]) ] = trim( $c[1] );
                                                        }
                                                        else
                                                        {
                                                            $arr[] = trim( $c[0] );
                                                        }
                                                    }
                                 
                                                    $head[ trim($t[0]) ] = $arr;
                                                }
                                                else
                                                {
                                                    $head[ trim($t[0]) ] = trim( $t[1] );
                                                }
                                            }
                                            else
                                            {
                                                $head[] = $v;
                                                if( preg_match( "#HTTP/[0-9\.]+\s+([0-9]+)#",$v, $out ) )
                                                {
                                                    $head['reponse_code'] = intval($out[1]);
                                                }
                                            }
                                        }
                                        return $head;
                                    }
                                }
                                echo "hello" ;
                                
                                   $con = new connecting_to_yemot_api('0733000000','1234');
                                      $token = "0733000000:1234";
                                   $add_phone = $con -> connecting('ValidationCallerId',
                                   [
                                    'token' =>$token,
                                	'action'=> 'send',
                                	     [
                                	     'callerId' => '0771234567' ,
                                		 'validType' => "CALL"
                                      	]
                                		
                                   ]
                                );
                                print_r($add_phone); 
                                
                                 ?>
                                
                                
                                אהרן שובקס M 2 תגובות תגובה אחרונה תגובה ציטוט 0
                                • אהרן שובקס
                                  אהרן שובקס ניהול @myrmyr נערך לאחרונה על ידי

                                  @myrmyr
                                  מה השגיאה שאתה מקבל?

                                  M תגובה 1 תגובה אחרונה תגובה ציטוט 0
                                  • M
                                    myrmyr @אהרן שובקס נערך לאחרונה על ידי

                                    @אהרן-שובקס

                                    hello
                                    Warning: Array to string conversion in C:\xampp\htdocs\test\abc.php on line 21
                                    stdClass Object ( [responseStatus] => Exception [yAfastVersion] => 6.1.18 [message] => Missing parameters [parameter] => callerId )
                                    
                                    M תגובה 1 תגובה אחרונה תגובה ציטוט 0
                                    • M
                                      MGM IVR מומחה @myrmyr נערך לאחרונה על ידי

                                      פוסט זה נמחק!
                                      תגובה 1 תגובה אחרונה תגובה ציטוט 0
                                      • M
                                        MGM IVR מומחה @myrmyr נערך לאחרונה על ידי MGM IVR

                                        @myrmyr אמר בעזרה בהוספת זיהוי ספיישל ב api:

                                        @אהרן-שובקס

                                        <?php 
                                        define("URL", "https://www.call2all.co.il/ym/api/");
                                        $server = "www";
                                        
                                        class BodyPost
                                        {
                                        // part "multipart/form-data"
                                            public static function PartPost($name, $val)
                                             {
                                                 $body = 'Content-Disposition: form-data; name="' . $name . '"';
                                        // check instance of oFile
                                                 if($val instanceof oFile)
                                                  {
                                                      $file = $val->Name();
                                                      $mime = $val->Mime();
                                                      $cont = $val->Content();
                                         
                                                      $body .= '; filename="' . $file . '"' . "\r\n";
                                                      $body .= 'Content-Type: ' . $mime ."\r\n\r\n";
                                                      $body .= $cont."\r\n";
                                                  } else $body .= "\r\n\r\n".$val."\r\n";
                                                 return $body;
                                             }
                                         
                                            public static function Get(array $post, $delimiter = '-------------0123456789')
                                             {
                                                 if(is_array($post) && !empty($post))
                                                  {
                                                      $bool = true;
                                                      //foreach($post as $val) if($val instanceof oFile) {$bool = true; break; };
                                                      if($bool)
                                                       {
                                                           $ret = '';
                                                           foreach($post as $name=>$val)
                                                               $ret .= '--' . $delimiter. "\r\n". self::PartPost($name, $val);
                                                           $ret .= "--" . $delimiter . "--\r\n";
                                                       } else $ret = http_build_query($post);
                                                  } else throw new \Exception('Error input param!');
                                                 return $ret;
                                             }
                                        }
                                         
                                        class oFile
                                        {
                                             private $name;
                                             private $mime;
                                             private $content;
                                         
                                             public function __construct($name, $mime=null, $content=null)
                                              {
                                                  if(is_null($content))
                                                   {
                                                       $info = pathinfo($name);
                                        // check is exist and readable file
                                                       if(!empty($info['basename']) && is_readable($name))
                                                        {
                                                            $this->name = $info['basename'];
                                        // get MIME
                                                            $this->mime = mime_content_type($name);
                                        // load file
                                                            $content = file_get_contents($name);
                                                            if($content!==false)
                                                            {
                                                                $this->content = $content;
                                                            }
                                                            else
                                                            {
                                                                throw new Exception('Don`t get content - "'.$name.'"');
                                                            }
                                                        }
                                                        else
                                                        {
                                                            throw new Exception('Error param');
                                                        }
                                                   }
                                                   else
                                                   {
                                                           $this->name = $name;
                                                           if(is_null($mime)) $mime = mime_content_type($name);
                                                           $this->mime = $mime;
                                                           $this->content = $content;
                                                    };
                                              }
                                         
                                            public function Name() { return $this->name; }
                                         
                                            public function Mime() { return $this->mime; }
                                         
                                            public function Content() { return $this->content; }
                                         
                                        }
                                         
                                        class connecting_to_yemot_api
                                        {
                                            public $token;
                                         
                                            const URL = URL;
                                         
                                            public function __construct($user_name, $password)
                                            {
                                                $body = array('username' => $user_name, 'password' => $password);
                                         
                                                $body = http_build_query($body);
                                         
                                                $opts = array('http' => array(
                                         
                                                    'method'  => 'POST',
                                         
                                                    'header'  => "Content-Type: application/x-www-form-urlencoded",
                                         
                                                    'content' => $body,
                                         
                                                    'follow_location' => false) );
                                         
                                                 $context  = stream_context_create($opts);
                                         
                                                 $url = self::URL.'Login';
                                         
                                                    $result = file_get_contents($url, FALSE, $context);
                                         
                                                    $result = json_decode($result);
                                         
                                                    if($result -> responseStatus == 'OK')
                                                    {
                                                        $this -> token = $result -> token;
                                         
                                                        return TRUE;
                                                    }
                                                    else
                                                    {
                                                        throw new Exception('שם המשתמש או הסיסמא של המערכת שגויים');
                                                    }
                                            }
                                         
                                            public function __destruct()
                                            {
                                                $this -> connecting('Logout');
                                            }
                                         
                                            public function connecting($action, $body = array())
                                            {
                                                $delimiter = '----'.uniqid();
                                         
                                                $body['token'] = $this -> token;
                                         
                                                $body = BodyPost::Get($body, $delimiter);
                                         
                                                $opts = array('http' =>
                                                        array(
                                                            'method'  => 'POST',
                                                            'header'  => 'Content-Type: multipart/form-data; boundary='.$delimiter,
                                                            'content' => $body,
                                                            'follow_location' => false
                                                            )
                                                          );
                                                $context  = stream_context_create($opts);
                                         
                                                $url = self::URL.$action;
                                         
                                                $result = file_get_contents($url, FALSE, $context);
                                         
                                                $headers = $this -> parseHeaders($http_response_header);
                                         
                                                if($headers['Content-Type'][0] == 'application/json')
                                                {
                                                    return json_decode($result);
                                                }
                                                else
                                                {
                                                    return $result;
                                                }
                                            }
                                         
                                            private function parseHeaders($headers)
                                            {
                                                // פונקציה שמקבלת מערך של שורות הכותרות
                                                // הפונקציה מפרקת את קבצי הקוקי לתת-מערך נפרד
                                         
                                         
                                                // מערך הכותרות
                                                $head = array();
                                         
                                                foreach( $headers as $k=>$v )
                                                {
                                                    $t = explode( ':', $v, 2 );
                                         
                                                    if( isset( $t[1] ) )
                                                    {
                                                        if($t[0] == 'Set-Cookie')
                                                        {
                                                            $CookiesArr = array();
                                         
                                                            $cookies = explode( ';', $t[1]);
                                         
                                                            foreach($cookies as $cookie)
                                                            {
                                                                $c = explode( '=', $cookie);
                                         
                                                                if( isset( $c[1] ) )
                                                                {
                                                                    $CookiesArr[ trim($c[0]) ] = trim( $c[1] );
                                                                }
                                                                else
                                                                {
                                                                    $CookiesArr[] = trim( $c[0] );
                                                                }
                                                            }
                                         
                                                            $head[ trim($t[0]) ] = $CookiesArr;
                                                        }
                                                        elseif($t[0] == 'Content-Type')
                                                        {
                                                            $arr = array();
                                         
                                                            $children = explode( ';', $t[1]);
                                         
                                                            foreach($children as $child)
                                                            {
                                                                $c = explode( '=', $child);
                                         
                                                                if( isset( $c[1] ) )
                                                                {
                                                                    $arr[ trim($c[0]) ] = trim( $c[1] );
                                                                }
                                                                else
                                                                {
                                                                    $arr[] = trim( $c[0] );
                                                                }
                                                            }
                                         
                                                            $head[ trim($t[0]) ] = $arr;
                                                        }
                                                        else
                                                        {
                                                            $head[ trim($t[0]) ] = trim( $t[1] );
                                                        }
                                                    }
                                                    else
                                                    {
                                                        $head[] = $v;
                                                        if( preg_match( "#HTTP/[0-9\.]+\s+([0-9]+)#",$v, $out ) )
                                                        {
                                                            $head['reponse_code'] = intval($out[1]);
                                                        }
                                                    }
                                                }
                                                return $head;
                                            }
                                        }
                                        echo "hello" ;
                                        
                                           $con = new connecting_to_yemot_api('0733000000','1234');
                                              $token = "0733000000:1234";
                                           $add_phone = $con -> connecting('ValidationCallerId',
                                           [
                                            'token' =>$token,
                                        	'action'=> 'send',
                                        	     [
                                        	     'callerId' => '0771234567' ,
                                        		 'validType' => "CALL"
                                              	]
                                        		
                                           ]
                                        );
                                        print_r($add_phone); 
                                        
                                         ?>
                                        
                                        

                                        בסוף תשנה את הקטע לזה

                                         $add_phone = $con -> connecting('ValidationCallerId',
                                           [
                                            'token' =>$token,
                                            'action'=> 'send',
                                            'callerId' => '0771234567' ,
                                        	'validType' => "CALL"		
                                           ]
                                        );
                                        print_r($add_phone); 
                                         
                                         ?>
                                        

                                        פשוט שלחת את הערכים בצורה לא נכונה

                                        M תגובה 1 תגובה אחרונה תגובה ציטוט 0
                                        • M
                                          myrmyr @MGM IVR נערך לאחרונה על ידי

                                          @MGM-IVR תודה רבה פתרת לי את הבעייה בס"ד
                                          (תנו לי לייקים כדי שאוכל לתת לייקים...)
                                          עכשיו נשאר לי רק לעשות בשלב השני של האימות, לתת לי אפשרות להקיש את הקוד שהתקבל בשיחה
                                          ולהעתיק אוטומטי מהשלב הראשון-send
                                          את ה reqid
                                          אולי להכניס אותו לתוך משתנה
                                          אבל אני לא הצלחתי להכניס תוצאה לתוך משתנה
                                          אשמח לעזרה
                                          תודה רבה

                                          M תגובה 1 תגובה אחרונה תגובה ציטוט 1
                                          • M
                                            MGM IVR מומחה @myrmyr נערך לאחרונה על ידי

                                            @myrmyr אמר בעזרה בהוספת זיהוי ספיישל ב api:

                                            עכשיו נשאר לי רק לעשות בשלב השני של האימות, לתת לי אפשרות להקיש את הקוד שהתקבל בשיחה

                                            אתה תיהיה חייב אם אתה משתמש בphp לרשום את הטוקן לאימות באיזה קובץ ואז לגשת שוב ולקרוא מהקובץ

                                            תגובה 1 תגובה אחרונה תגובה ציטוט 1
                                            • פוסט ראשון
                                              פוסט אחרון