How to use getParameter method of http class

Best Atoum code snippet using http.getParameter

CommentController.php

Source:CommentController.php Github

copy

Full Screen

...26 {27 try {28 $arrRequest = Util::getArrRequest();29 Util::responseJson();30 $type = Util::getParameter($arrRequest, 'type', 'string');31 $page = Util::getParameter($arrRequest, 'page', 'int', false);32 $page = empty ($page) ? 1 : $page;33 if ($type === 'article') { //拉取文章评论34 $tid = Util::getParameter($arrRequest, 'tid', 'int'); //文章id35 $list = $this->getCommentsOfArcticle($tid, $page, 'position');36 return [37 'errid' => ErrorCode::OK,38 'errmsg' => ErrorCode::$msgArr[ErrorCode::OK],39 'content' => [40 'arr' => $list41 ],42 ];43 } elseif ($type === 'user') {44 $postid = util::getParameter($arrRequest, 'postid', 'int');45 $list = Comment::getCommentsOfComments($postid, $page);46 return [47 'errid' => ErrorCode::OK,48 'errmsg' => ErrorCode::$msgArr[ErrorCode::OK],49 'content' => $list50 ];51 }52 } catch (Exception $e) {53 \Yii::error("actionCommentlist is error msg = {$e->getMessage()}");54 return [55 'errid' => ErrorCode::HACKER_COME,56 'errmsg' => ErrorCode::$msgArr[ErrorCode::HACKER_COME],57 'content' => ''58 ];59 }60 }61 public function getCommentsOfArcticle($tid, $page, $order = 'position')62 {63 if($order === 'hot') {64 $list = Comment::getHostsComment($tid, $page);65 } else {66 $list = Comment::getCommentsOfarticle($tid, $page, $order);67 }68 return $list;69 }70 public function actionPostcomment()71 {72 $arrRequest = Util::getArrRequest();73 Util::responseJson();74 try{75 $action = Util::getParameter ( $arrRequest, 'action', 'string' );76 }catch (Exception $e){77 \Yii::error("actionPostcomment {$e->getMessage()}");78 return [79 'errid'=> ErrorCode::HTTP_PARAMS_ILLEGAL,80 'errmsg'=> ErrorCode::$msgArr[ErrorCode::HTTP_PARAMS_ILLEGAL],81 ];82 }83 if($action == 'reply') {84 try{85 $type = Util::getParameter ( $arrRequest, 'type', 'string' );86 $tid = Util::getParameter ( $arrRequest, 'tid', 'int' );87 $pname = Util::getParameter ( $arrRequest, 'pname', 'string' );88 $pid = Util::getParameter ( $arrRequest, 'pid', 'string' );89 $recvUsername = Util::getParameter ( $arrRequest, 'receiveUsername', 'string',false);90 $recvUserid = Util::getParameter ( $arrRequest, 'receiveUserid', 'int',false);91 $project_id = Util::getParameter ( $arrRequest, 'project', 'int' );92 $cid = util::getParameter ( $arrRequest, 'postid', 'int', false );93 $msg = trim ( Util::getParameter ( $arrRequest, 'msg', 'string' ) );94 $pid = BabelCrypt::decryptNumber($pid);95 $voptid = 0;96 }catch (Exception $e){97 \Yii::error("actionPostcomment {$e->getMessage()}");98 return [99 'errid'=> ErrorCode::HTTP_PARAMS_ILLEGAL,100 'errmsg'=> ErrorCode::$msgArr[ErrorCode::HTTP_PARAMS_ILLEGAL],101 ];102 }103 return $this->addComment($action, $type, $tid, $pname, $pid, $recvUsername, $recvUserid, $msg, $voptid, $cid,$project_id);104 }elseif($action=='vote'){105 try{106 $tid = Util::getParameter ( $arrRequest, 'tid', 'int' );107 $pname = Util::getParameter ( $arrRequest, 'pname', 'string' );108 $pid = Util::getParameter ( $arrRequest, 'pid', 'string' );109 $msg = trim ( Util::getParameter ( $arrRequest, 'msg', 'string',false ) );110 $voptid= Util::getParameter ( $arrRequest, 'vollid', 'int', false );111 $project_id = Util::getParameter ( $arrRequest, 'project', 'int' );112 $pid = BabelCrypt::decryptNumber($pid);113 }catch (Exception $e){114 return [115 'errid'=> ErrorCode::HTTP_PARAMS_ILLEGAL,116 'errmsg'=> ErrorCode::$msgArr[ErrorCode::HTTP_PARAMS_ILLEGAL],117 ];118 }119 return $this->addComment($action, 'article', $tid, $pname, $pid, "", 0, $msg, $voptid, 0,$project_id);120 }elseif($action == 'praise'){121 try{122 $tid = Util::getParameter ( $arrRequest, 'tid', 'int' );123 $pid = Util::getParameter ( $arrRequest, 'pid', 'string' );124 //$username = Util::getParameter ( $arrRequest, 'pname', 'string' );125 $pid = BabelCrypt::decryptNumber($pid);126 }catch (Exception $e){127 return [128 'errid'=> ErrorCode::HTTP_PARAMS_ILLEGAL,129 'errmsg'=> ErrorCode::$msgArr[ErrorCode::HTTP_PARAMS_ILLEGAL],130 ];131 }132 return $this->addComment($action, 'article', $tid, "", $pid, "", 0, "", 0, 0,0);133 }else{134 return [135 'errid'=> ErrorCode::HTTP_PARAMS_ILLEGAL,136 'errmsg'=> ErrorCode::$msgArr[ErrorCode::HTTP_PARAMS_ILLEGAL],137 ];138 }139 }140 public function actioncommentaticle() {141 $arrRequest = Util::getArrRequest();142 Util::responseJson();143 try{144 $info['action'] = Util::getParameter ( $arrRequest, 'action', 'string' );145 $info['type'] = Util::getParameter ( $arrRequest, 'type', 'string' );146 $info['tid'] = Util::getParameter ( $arrRequest, 'tid', 'int' );147 $info['username'] = Util::getParameter ( $arrRequest, 'pname', 'string' );148 $info['userid'] = Util::getParameter ( $arrRequest, 'pid', 'string' );149 $info['recv_username'] = Util::getParameter ( $arrRequest, 'receiveUsername', 'string',false);150 $info['recv_userid'] = Util::getParameter ( $arrRequest, 'receiveUserid', 'int',false);151 $info['project_id'] = Util::getParameter ( $arrRequest, 'project', 'string' );152 $info['id'] = util::getParameter ( $arrRequest, 'postid', 'int', false );153 $info['message'] = trim ( Util::getParameter ( $arrRequest, 'msg', 'string' ) );154 $info['userid'] = BabelCrypt::decryptNumber($info['userid']);155 return $this->addComment($info);156 }catch (Exception $e){157 \Yii::error("actionPostcomment {$e->getMessage()}");158 return [159 'errid'=> ErrorCode::HTTP_PARAMS_ILLEGAL,160 'errmsg'=> ErrorCode::$msgArr[ErrorCode::HTTP_PARAMS_ILLEGAL],161 ];162 }163 }164 /**165 * @param $action 标识文章,投票,推荐评论166 * @param $type 标识父评论或子评论167 * @param $tid 文章/投票/推荐id...

Full Screen

Full Screen

payNotifyUrl.php

Source:payNotifyUrl.php Github

copy

Full Screen

...16 //判断签名17 if($resHandler->isTenpaySign()) {18 19 //通知id20 $notify_id = $resHandler->getParameter("notify_id");21 22 //通过通知ID查询,确保通知来至财付通23 //创建查询请求24 $queryReq = new RequestHandler();25 $queryReq->init();26 $queryReq->setKey($key);27 $queryReq->setGateUrl("https://gw.tenpay.com/gateway/simpleverifynotifyid.xml");28 $queryReq->setParameter("partner", $partner);29 $queryReq->setParameter("notify_id", $notify_id);30 31 //通信对象32 $httpClient = new TenpayHttpClient();33 $httpClient->setTimeOut(5);34 //设置请求内容35 $httpClient->setReqContent($queryReq->getRequestURL());36 37 //后台调用38 if($httpClient->call()) {39 //设置结果参数40 $queryRes = new ClientResponseHandler();41 $queryRes->setContent($httpClient->getResContent());42 $queryRes->setKey($key);43 44 if($resHandler->getParameter("trade_mode") == "1"){45 //判断签名及结果(即时到帐)46 //只有签名正确,retcode为0,trade_state为0才是支付成功47 if($queryRes->isTenpaySign() && $queryRes->getParameter("retcode") == "0" && $resHandler->getParameter("trade_state") == "0") {48 log_result("即时到帐验签ID成功");49 //取结果参数做业务处理50 $out_trade_no = $resHandler->getParameter("out_trade_no");51 //财付通订单号52 $transaction_id = $resHandler->getParameter("transaction_id");53 //金额,以分为单位54 $total_fee = $resHandler->getParameter("total_fee");55 //如果有使用折扣券,discount有值,total_fee+discount=原请求的total_fee56 $discount = $resHandler->getParameter("discount");57 58 //------------------------------59 //处理业务开始60 //------------------------------61 62 //处理数据库逻辑63 //注意交易单不要重复处理64 //注意判断返回金额65 66 //------------------------------67 //处理业务完毕68 //------------------------------69 log_result("即时到帐后台回调成功");70 echo "success";71 72 } else {73 //错误时,返回结果可能没有签名,写日志trade_state、retcode、retmsg看失败详情。74 //echo "验证签名失败 或 业务错误信息:trade_state=" . $resHandler->getParameter("trade_state") . ",retcode=" . $queryRes-> getParameter("retcode"). ",retmsg=" . $queryRes->getParameter("retmsg") . "<br/>" ;75 log_result("即时到帐后台回调失败");76 echo "fail";77 }78 }elseif ($resHandler->getParameter("trade_mode") == "2")79 80 {81 //判断签名及结果(中介担保)82 //只有签名正确,retcode为0,trade_state为0才是支付成功83 if($queryRes->isTenpaySign() && $queryRes->getParameter("retcode") == "0" ) 84 {85 log_result("中介担保验签ID成功");86 //取结果参数做业务处理87 $out_trade_no = $resHandler->getParameter("out_trade_no");88 //财付通订单号89 $transaction_id = $resHandler->getParameter("transaction_id");90 91 //------------------------------92 //处理业务开始93 //------------------------------94 95 //处理数据库逻辑96 //注意交易单不要重复处理97 //注意判断返回金额98 99 log_result("中介担保后台回调,trade_state=".$resHandler->getParameter("trade_state"));100 switch ($resHandler->getParameter("trade_state")) {101 case "0": //付款成功102 103 break;104 case "1": //交易创建105 106 break;107 case "2": //收获地址填写完毕108 109 break;110 case "4": //卖家发货成功111 112 break;113 case "5": //买家收货确认,交易成功114 115 break;116 case "6": //交易关闭,未完成超时关闭117 118 break;119 case "7": //修改交易价格成功120 121 break;122 case "8": //买家发起退款123 124 break;125 case "9": //退款成功126 127 break;128 case "10": //退款关闭 129 130 break;131 default:132 //nothing to do133 break;134 }135 136 137 //------------------------------138 //处理业务完毕139 //------------------------------140 echo "success";141 } else142 143 {144 //错误时,返回结果可能没有签名,写日志trade_state、retcode、retmsg看失败详情。145 //echo "验证签名失败 或 业务错误信息:trade_state=" . $resHandler->getParameter("trade_state") . ",retcode=" . $queryRes-> getParameter("retcode"). ",retmsg=" . $queryRes->getParameter("retmsg") . "<br/>" ;146 log_result("中介担保后台回调失败");147 echo "fail";148 }149 }150 151 152 153 //获取查询的debug信息,建议把请求、应答内容、debug信息,通信返回码写入日志,方便定位问题154 /*155 echo "<br>------------------------------------------------------<br>";156 echo "http res:" . $httpClient->getResponseCode() . "," . $httpClient->getErrInfo() . "<br>";157 echo "query req:" . htmlentities($queryReq->getRequestURL(), ENT_NOQUOTES, "GB2312") . "<br><br>";158 echo "query res:" . htmlentities($queryRes->getContent(), ENT_NOQUOTES, "GB2312") . "<br><br>";159 echo "query reqdebug:" . $queryReq->getDebugInfo() . "<br><br>" ;...

Full Screen

Full Screen

getParameter

Using AI Code Generation

copy

Full Screen

1$var1 = $http->getParameter("var1");2$var2 = $http->getParameter("var2");3$var3 = $http->getParameter("var3");4$var4 = $http->getParameter("var4");5$var5 = $http->getParameter("var5");6$var6 = $http->getParameter("var6");7$var7 = $http->getParameter("var7");8$var8 = $http->getParameter("var8");9$var9 = $http->getParameter("var9");10$var10 = $http->getParameter("var10");11$var11 = $http->getParameter("var11");12$var12 = $http->getParameter("var12");13$var13 = $http->getParameter("var13");14$var14 = $http->getParameter("var14");15$var15 = $http->getParameter("var15");16$var16 = $http->getParameter("var16");17$var17 = $http->getParameter("var17");18$var18 = $http->getParameter("var18");19$var19 = $http->getParameter("var19");20$var20 = $http->getParameter("var20");21$var21 = $http->getParameter("var21");22$var22 = $http->getParameter("var22");23$var23 = $http->getParameter("var23");24$var24 = $http->getParameter("var24");25$var25 = $http->getParameter("var25");26$var26 = $http->getParameter("var26");27$var27 = $http->getParameter("var27");28$var28 = $http->getParameter("var28");29$var29 = $http->getParameter("var29");30$var30 = $http->getParameter("var30");31$var31 = $http->getParameter("var31");32$var32 = $http->getParameter("var32");33$var33 = $http->getParameter("var33");34$var34 = $http->getParameter("var34");35$var35 = $http->getParameter("var35");36$var36 = $http->getParameter("var36");37$var37 = $http->getParameter("var37");38$var38 = $http->getParameter("var38");39$var39 = $http->getParameter("var39");40$var40 = $http->getParameter("var40");41$var41 = $http->getParameter("var41");

Full Screen

Full Screen

getParameter

Using AI Code Generation

copy

Full Screen

1$param = $this->http->getParameter("name");2echo $param;3$param = $this->http->getParameter("name");4echo $param;5$param = $this->http->getParameter("name");6echo $param;7$param = $this->http->getParameter("name");8echo $param;9$param = $this->http->getParameter("name");10echo $param;11$param = $this->http->getParameter("name");12echo $param;13$param = $this->http->getParameter("name");14echo $param;15$param = $this->http->getParameter("name");16echo $param;17$param = $this->http->getParameter("name");18echo $param;19$param = $this->http->getParameter("name");20echo $param;21$param = $this->http->getParameter("name");22echo $param;23$param = $this->http->getParameter("name");24echo $param;25$param = $this->http->getParameter("name");26echo $param;27$param = $this->http->getParameter("name");28echo $param;29$param = $this->http->getParameter("name");30echo $param;

Full Screen

Full Screen

getParameter

Using AI Code Generation

copy

Full Screen

1$param = http_get_parameter("param1");2echo $param;3$param = http_get_parameter("param2");4echo $param;5$param = http_get_parameter("param3");6echo $param;7$param = http_get_parameter("param4");8echo $param;9$param = http_get_parameter("param5");10echo $param;11$param = http_get_parameter("param6");12echo $param;13$param = http_get_parameter("param7");14echo $param;15$param = http_get_parameter("param8");16echo $param;17$param = http_get_parameter("param9");18echo $param;19$param = http_get_parameter("param10");20echo $param;21$param = http_get_parameter("param11");22echo $param;23$param = http_get_parameter("param12");24echo $param;25$param = http_get_parameter("param13");26echo $param;27$param = http_get_parameter("param14");28echo $param;29$param = http_get_parameter("param15");30echo $param;31$param = http_get_parameter("param16");32echo $param;

Full Screen

Full Screen

getParameter

Using AI Code Generation

copy

Full Screen

1$name = $http->getParameter("name");2$age = $http->getParameter("age");3$address = $http->getParameter("address");4$city = $http->getParameter("city");5$state = $http->getParameter("state");6$zip = $http->getParameter("zip");7$phone = $http->getParameter("phone");8$email = $http->getParameter("email");9$password = $http->getParameter("password");10$confirmpassword = $http->getParameter("confirmpassword");11$cardtype = $http->getParameter("cardtype");12$cardnumber = $http->getParameter("cardnumber");13$cardname = $http->getParameter("cardname");

Full Screen

Full Screen

getParameter

Using AI Code Generation

copy

Full Screen

1http = new http();2http.getparameter("name");3http.getparameter("email");4http.getparameter("phone");5http.getparameter("message");6http = new http();7http.postparameter("name");8http.postparameter("email");9http.postparameter("phone");10http.postparameter("message");11http = new http();12http.getCookie("name");13http.getCookie("email");14http.getCookie("phone");15http.getCookie("message");16http = new http();17http.setCookie("name");18http.setCookie("email");19http.setCookie("phone");20http.setCookie("message");21http = new http();22http.getHeader("name");23http.getHeader("email");24http.getHeader("phone");25http.getHeader("message");26http = new http();27http.setHeader("name");28http.setHeader("email");29http.setHeader("phone");30http.setHeader("message");31http = new http();32http.getparameter("name");33http.getparameter("email");34http.getparameter("phone");35http.getparameter("message");36http = new http();37http.postparameter("name");38http.postparameter("email");39http.postparameter("phone");40http.postparameter("message");41http = new http();42http.getCookie("name");43http.getCookie("email");44http.getCookie("phone");45http.getCookie("message");46http = new http();47http.setCookie("name");48http.setCookie("email");49http.setCookie("phone");50http.setCookie("message");51http = new http();52http.getHeader("name");53http.getHeader("email");54http.getHeader("phone");55http.getHeader("message");56http = new http();57http.setHeader("name");58http.setHeader("email");59http.setHeader("phone");60http.setHeader("message");61http = new http();62http.getparameter("name");63http.getparameter("email");

Full Screen

Full Screen

getParameter

Using AI Code Generation

copy

Full Screen

1require_once 'HTTP.php';2$http = new HTTP();3echo $http->getParameter('a');4require_once 'HTTP.php';5$http = new HTTP();6echo $http->getParameter('a');7require_once 'HTTP.php';8$http = new HTTP();9echo $http->getParameter('a');10require_once 'HTTP.php';11$http = new HTTP();12echo $http->getParameter('a');13require_once 'HTTP.php';14$http = new HTTP();15echo $http->getParameter('a');16require_once 'HTTP.php';17$http = new HTTP();18echo $http->getParameter('a');19require_once 'HTTP.php';20$http = new HTTP();21echo $http->getParameter('a');22require_once 'HTTP.php';23$http = new HTTP();24echo $http->getParameter('a');25require_once 'HTTP.php';26$http = new HTTP();27echo $http->getParameter('a');28require_once 'HTTP.php';29$http = new HTTP();30echo $http->getParameter('a');31require_once 'HTTP.php';32$http = new HTTP();33echo $http->getParameter('a');

Full Screen

Full Screen

getParameter

Using AI Code Generation

copy

Full Screen

1require_once('HTTP.php');2$http = new HTTP();3$param = $http->getParameter('param');4echo $param;5require_once('HTTP.php');6$http = new HTTP();7$param = $http->getParameter('param');8echo $param;9{10 public function getParameter($param)11 {12 if(isset($_GET[$param]))13 {14 return $_GET[$param];15 }16 return null;17 }18}19require_once('HTTP.php');20$http = new HTTP();21$param = $http->getPostParameter('param');22echo $param;23require_once('HTTP.php');24$http = new HTTP();25$param = $http->getPostParameter('param');26echo $param;

Full Screen

Full Screen

getParameter

Using AI Code Generation

copy

Full Screen

1$myvar = $HTTP_GET_VARS["myvar"];2echo $myvar;3$myvar = $HTTP_COOKIE_VARS["myvar"];4echo $myvar;5$myvar = $HTTP_SESSION_VARS["myvar"];6echo $myvar;7$myvar = $HTTP_SERVER_VARS["myvar"];8echo $myvar;9$myvar = $HTTP_POST_FILES["myvar"];10echo $myvar;11$myvar = $HTTP_REQUEST_VARS["myvar"];12echo $myvar;13$myvar = $HTTP_ENV_VARS["myvar"];14echo $myvar;15$myvar = $HTTP_GLOBAL_VARS["myvar"];16echo $myvar;17$myvar = $HTTP_GET_VARS["myvar"];18echo $myvar;

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Trigger getParameter code on LambdaTest Cloud Grid

Execute automation tests with getParameter on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful