As an excellent worker, PHP – http_ Request2 access SMS verification code is not easy to grasp

Time:2020-11-14

As an excellent worker, PHP – http_ Request2 access SMS verification code is not easy to grasp

Some time ago, the stem of the migrant workers suddenly caught fire: the soul of the migrant workers, the workers are all on the people.

As a senior worker, I’d like to share PHP – HTTP with you today_ We hope you can use the example of request2 access SMS verification code:

`<?php
require_once ‘HTTP/Request2.php’;
$request = new HTTP_Request2();
$request->setUrl(‘https://vip.veesing.com/smsAp…‘);
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
‘follow_redirects’ => TRUE
));
$request->setHeader(array(
‘Content-Type’ => ‘application/x-www-form-urlencoded;charset=utf-8’
));
$request->addPostParameter(array(
‘appId’ => ’41KYR0EB**’,
‘appKey’ => ‘IIWCKKSR7NOQ**’,
‘phone’ => ‘1561894**’,
‘templateId’ => ‘1043’,
‘variables’ => ‘1234’
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {

echo $response->getBody();

}
else {

echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();

}
}
catch(HTTP_Request2_Exception $e) {
echo ‘Error: ‘ . $e->getMessage();
}`

That’s PHP – http_ The example of request2 access SMS verification code, if you think it’s useful, you can collect it, in case you need it one day, and then you can’t find it!

PHP – HTTP_ Request 2. PHP and documentation Download