connect_errno){
$err = "CONNECT FAIL: ". $mysqli->connect_errno.' '.$mysqli->connect_error;
$err_cnt++;
}
$debug=$_REQUEST["d"];
$gsp_access_token="not_set";
$q23="SELECT `gsp_access_token`,`gsp_refresh_token`,`gsp_exp` FROM `gsp_auth` WHERE `co_gstin`='".$co_gstin."' AND `gsp_exp`>'$nxt1min' ORDER BY `ga_id` DESC LIMIT 1";
//exit($q23);
$g_gsp=$mysqli->query($q23);
if(!$g_gsp){echo " GSA Detail error. Possible reasons ". $mysqli->error."
$q23";;exit;}
while($gsa=$g_gsp->fetch_array()){
$gsp_access_token=$gsa["gsp_access_token"];
$gsp_refresh_token=$gsa["gsp_refresh_token"];
$gsp_exp=$gsa["gsp_exp"];
}
if($gsp_access_token=='not_set'){
$q40="SELECT * FROM `gsp_details` WHERE `co_gstin`='".$co_gstin."' AND `gsp_status`='active' LIMIT 1";
$g_gsp=$mysqli->query($q40);
if(!$g_gsp){echo "GSP Detail error. Possible reasons ". $mysqli->error."
$q40";;exit;}
while($gsro=$g_gsp->fetch_array()){
$gsp_un=$gsro["gsp_un"];
$gsp_pw=$gsro["gsp_pw"];
$gsp_client_id=$gsro["gsp_client_id"];
$gsp_authorisation=$gsro["gsp_authorisation"];
$gsp_base_url=$gsro["gsp_base_url"];
}
// // $gsp_un="erp1%40perennialsys.com";
// // $gsp_pw="einv12345";
// // $gsp_client_id="testerpclient";
// // $gsp_authorisation="Basic dGVzdGVycGNsaWVudDpBZG1pbkAxMjM=";
// // $gsp_base_url="http://35.154.208.8:8080";
//$co_gstin="29AFQPB8708K000";
// Script to test if the CURL extension is installed on this server
// Ouput text to user based on test
if (_is_curl_installed()) {
//echo "cURL is Installed on this server.
// Access Token : $access_token=$responseJson->access_token; // Token type : $token_type=$responseJson->token_type; // Refresh token : $refresh_token=$responseJson->refresh_token;; // Expires in : $expires_in=$responseJson->expires_in;; // Scope : $scope=$responseJson->scope; //"; }else{ echo "GSP Credentials Error: ".$responseJson->error_description."