Jump to content

[SOLVED] (need HELP!) syntax error: unexpected T_String


nicx

Recommended Posts

Mr.Please help me with my php code. Because that a error message. Syntax error: unexpected T_String on line 40. The code is

<?php

   define("EZXEZ_LIB",      "new EzXez Lib");
   define("EZXEZ_VER",      "1.0Beta");
   define("EZXEZ_BUILD",   "Gunakan format 8xxxx. Ex: 8561234556");
   define("EZXEZ_AUTH",   "nicx at www.nabrak.biz.tm");
   
    define("EZXEZ_LOGIN",    "http://www.nabrak.biz.tm/ezxez/index.php");
    define("EZXEZ_KIRIM",    "http://www.nabrak.biz.tm/ezxez/index.php");

   Class EZXEZ {
      var 
         $status = array(),
         $viewstate,
         $cookie, 
         $ch,
         $newurl,
         $is_init,
         $cimg,
         $vstate,
         $cLoaded;
                  
      function LibName() {
         return array(EZXEZ_LIB,EZXEZ_VER,EZXEZ_BUILD,EZXEZ_AUTH);
      }
      
      function UserAgent(){
         $agent = EZXEZ_LIB.'/';
         $agent .= EZXEZ_VER.'(';
         $agent .= EZXEZ_BUILD.'-';
         $agent .= EZXEZ_AUTH;
         return $agent;
      }
      function Login($user, $pass){
         $loginPost = "user=".$this->tujuan($user)."&pass=".$pass.";
         
          $login = $this->useCurl(EZXEZ_LOGIN,$loginPost);
         
         //Login failed. Please try again <== Kata kata kalo login error
         ereg("Gagal",$login,$error);
         if (!empty($error[0])) return 0;
         return 1;
      }
      
      function tujuan($nomor){
         ereg('[0-9]+',$nomor,$no);
         if (empty($no[0]))
            return $nomor;
         else{
            $kiri = substr($no[0],0,1);
            $sisa = substr($no[0],1);
            if ($kiri == 0)   $kiri = '';
            return $kiri.$sisa;
         }
      }
      
      function kirimSms ($tujuan, $pesan) {

         $pesan    = rawurlencode($pesan);
         $tujuan = $this->tujuan($tujuan);
         
         $kirimPost    = "tujuan=".$tujuan."&pesan=".$pesan.";
                  
         $this->newurl='';
         $kirim    = $this->useCurl(EZXEZ_KIRIM,$kirimPost);
         $cek = $this->useCurl($this->newurl);
         ereg("You have passed your daily limit to numbers outside EZXEZ",$cek,$limit);
         if (!empty($limit[0])) return array(0,$limit[0]);
         return array(1,$tujuan);
       }
      
      function myCurl($load=1){
         if($load && !$this->cLoaded){
            $this->ch = curl_init();
            $this->cLoaded=1;
         }elseif(!$load && $this->cLoaded){
            curl_close($this->ch);
            $this->cLoaded=0;
         }
      }
      
       Public Function useCurl($url, $postfield = '',$headonly=0){
         $this->myCurl();
          if ($postfield) {
            curl_setopt($this->ch, CURLOPT_POST       , 1);
            curl_setopt($this->ch, CURLOPT_POSTFIELDS   , $postfield);
         }else
         curl_setopt($this->ch, CURLOPT_HTTPGET      , 1);
         curl_setopt($this->ch, CURLOPT_NOBODY         , $headonly);
         curl_setopt($this->ch, CURLOPT_NOBODY         , 0);         
          curl_setopt($this->ch, CURLOPT_URL            , $url);
          curl_setopt($this->ch, CURLOPT_USERAGENT      , $this->UserAgent());
         curl_setopt($this->ch, CURLOPT_HEADER         , 1);
         curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT   , 10);         
          curl_setopt($this->ch, CURLOPT_COOKIE         , $this->cookie);
         curl_setopt($this->ch, CURLOPT_RETURNTRANSFER   , 1);
         
          $execute = curl_exec($this->ch);

         preg_match_all('/Set-Cookie: (.*?)\r\n/', $execute, $roti);
         if ($roti[1]) $this->cookie = implode(';', $roti[1]);
         preg_match('/Location:(.*?)\r\n/', $execute, $ngikut);
         $this->newurl = trim($ngikut[1]);
         return $execute;
      }
   }
?>

<?php

   $sv = array_merge ($_ENV, $_SERVER, $HTTP_ENV_VARS, $HTTP_SERVER_VARS);
   $sp = array_merge ($HTTP_POST_VARS, $HTTP_GET_VARS);
   
   $GOTEXT = new EZXEZ();

   $user = $sp['user'];
   $pass = $sp['pass'];
   $nick = $sp['nick'];
   $text = $sp['text'];
   $rcpt = $sp['rcpt'];
   $action = $sp['action'];
   
   if ($action == 'config'){
      echo '
      <config>
         <t>EZXEZ SMS Service for GoText by nabrak.biz.tm indonesia only</t>
         <nu>1</nu>
         <np>1</np>
         <nn>0</nn>
         <mr>1</mr>
         <mc>160</mc>
         <in>10</in>
         <mm>100</mm>
      </config>
      ';
   }elseif   ($GOTEXT->Login($user, $pass)) {
      $kirim = $GOTEXT->kirimSms($rcpt, $text);
      if ($kirim[0]){
         respon (0,'SMS terkirim ke  '.$kirim[1]);
      }else
         respon (3,'SMS Gagal terkirim');
   }else
      respon (2,'User atau Password salah');
      
   function respon($no,$text){
      $GOTXT = new EZXEZ();
      $me = $GOTXT->LibName();
      echo '
         <res>
            <num>'.$no.'</num>
             <txt>'.$text.'
         
         '.$me[0].'  '.$me[1].'
         '.$me[3].'</txt>
         </res>
      ';
   }

?>

please help me to find the wrong with my php code. Thank you..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.