nicx Posted December 1, 2008 Share Posted December 1, 2008 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 https://forums.phpfreaks.com/topic/134983-solved-need-help-syntax-error-unexpected-t_string/ Share on other sites More sharing options...
nicx Posted December 1, 2008 Author Share Posted December 1, 2008 Please help,im very confuse to find that. Because im a newbie in php. Thanks before Link to comment https://forums.phpfreaks.com/topic/134983-solved-need-help-syntax-error-unexpected-t_string/#findComment-702959 Share on other sites More sharing options...
Prismatic Posted December 1, 2008 Share Posted December 1, 2008 $loginPost = "user=".$this->tujuan($user)."&pass=".$pass."; to $loginPost = "user=".$this->tujuan($user)."&pass=".$pass; Link to comment https://forums.phpfreaks.com/topic/134983-solved-need-help-syntax-error-unexpected-t_string/#findComment-702961 Share on other sites More sharing options...
nicx Posted December 1, 2008 Author Share Posted December 1, 2008 $loginPost = "user=".$this->tujuan($user)."&pass=".$pass."; to $loginPost = "user=".$this->tujuan($user)."&pass=".$pass; Thx bro,i will try it Link to comment https://forums.phpfreaks.com/topic/134983-solved-need-help-syntax-error-unexpected-t_string/#findComment-702985 Share on other sites More sharing options...
nicx Posted December 1, 2008 Author Share Posted December 1, 2008 Thankz for your help! Link to comment https://forums.phpfreaks.com/topic/134983-solved-need-help-syntax-error-unexpected-t_string/#findComment-702990 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.