app/Http/Controllers/BrightpearlController.php
// This method checks Brightpearl api connection by given api creds
This method checks Brightpearl api connection by given api creds
This method checks Brightpearl api connection by given api creds
public function checkBPCredentials($app_ref,$account_token,$account_name)
		{
			$ch = curl_init();
			curl_setopt($ch, CURLOPT_URL, env('BP_API_BASE_URL').$account_name."/warehouse-service/warehouse");
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
			$headers = array();
			$headers[] = 'brightpearl-app-ref: '.$app_ref;
			$headers[] = 'brightpearl-account-token: '.$account_token;
			curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
			$result = curl_exec($ch);
			if (curl_errno($ch)) {
				echo 'Error:' . curl_error($ch);
			}
			$info = curl_getinfo($ch);
			curl_close($ch);
			$status = false;
			if($info['http_code']==200 || $info['http_code']==201){
				$status = true;
			}
			return $status;
		}
public function checkBPCredentials ( $ app_ref , $ account_token , $ account_name ) { $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , env ( 'BP_API_BASE_URL' ) . $ account_name . " /warehouse-service/warehouse " ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , 1 ) ; curl_setopt ( $ ch , CURLOPT_CUSTOMREQUEST , 'GET' ) ; $ headers = array ( ) ; $ headers [ ] = 'brightpearl-app-ref: ' . $ app_ref ; $ headers [ ] = 'brightpearl-account-token: ' . $ account_token ; curl_setopt ( $ ch , CURLOPT_HTTPHEADER , $ headers ) ; $ result = curl_exec ( $ ch ) ; if ( curl_errno ( $ ch ) ) { echo 'Error:' . curl_error ( $ ch ) ; } $ info = curl_getinfo ( $ ch ) ; curl_close ( $ ch ) ; $ status = false ; if ( $ info [ 'http_code' ] == 200 || $ info [ 'http_code' ] == 201 ) { $ status = true ; } return $ status ; }
This method checks Brightpearl api connection by given api creds
This method checks Brightpearl api connection by given api creds