locked
Explanation RRS feed

  • Question

  • I see this code in my php translator

    public function translate($from, $to, $text, $format = 'Raw' )
    {
        if(empty($to) || empty($text)) {
            $this->getErrorResponse($response, self::MISSING_ERROR, $missing);
            return;
        }

    // what is this line doing? my $from is empty where is $this->from coming from?
        $this->from = (!empty($this->from )) ? $this->sanitize($from) : '';
        $this->to = $this->sanitize($to);
        $this->textToTranslate = $this->sanitize($text);
        $this->format = $format;
        $request = $this->getRequest(self::TRANSLATE );
       
        echo "from as this:" . $this->from ."@@ param from as param:". $from.  "<br/>";
        echo $request."<br/>";

        $response = file_get_contents( $request, 0, $this->context );
       
        if(!empty($response) && isset($response)){
            $this->getSuccessResponse($response);
        } else {
            $this->getErrorResponse($response, self::UNEXPECTED_ERROR, $missing );
        }

    }

    Saturday, December 20, 2014 4:32 PM

All replies

  • Hi, 

    What's your question? Is this one related this other one you posted: https://social.msdn.microsoft.com/Forums/en-US/fe25f935-e717-4d0d-a1f8-37325a8787fb/i-am-using-the-php-wrapper-and-got-errors?forum=translator


    Microsoft Translator team - www.microsoft.com/Translator

    Tuesday, December 23, 2014 8:11 AM