app/Http/Controllers/ShopifyController.php
// Function to check shopify account credentials whether it is exist and valid or not
Function to check shopify account credentials whether it is exist and valid or not
Function to check shopify account credentials whether it is exist and valid or not
public function checkShopifyCredentials($shopify_domain,$access_token)
		{
			$curl = curl_init();
			curl_setopt_array($curl, array(
			  CURLOPT_URL => 'https://'.$shopify_domain.'/admin/api/2021-01/webhooks.json',
			  CURLOPT_RETURNTRANSFER => true,
			  CURLOPT_ENCODING => '',
			  CURLOPT_MAXREDIRS => 10,
			  CURLOPT_TIMEOUT => 0,
			  CURLOPT_FOLLOWLOCATION => true,
			  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
			  CURLOPT_CUSTOMREQUEST => 'GET',
			  CURLOPT_HTTPHEADER => array(
				'Content-Type: application/json',
				'X-Shopify-Access-Token: '.$access_token,
			  ),
			));
			$result = curl_exec($curl);
			if (curl_errno($curl)) {
				echo 'Error:' . curl_error($curl);
			}
			$info = curl_getinfo($curl);
			curl_close ($curl);
			$status = false;
			if($info['http_code']==200 || $info['http_code']==201){
				$status = true;
			}
			return $status;
		}
public function checkShopifyCredentials ( $ shopify_domain , $ access_token ) { $ curl = curl_init ( ) ; curl_setopt_array ( $ curl , array ( CURLOPT_URL => 'https://' . $ shopify_domain . '/admin/api/2021-01/webhooks.json' , CURLOPT_RETURNTRANSFER => true , CURLOPT_ENCODING => '' , CURLOPT_MAXREDIRS => 10 , CURLOPT_TIMEOUT => 0 , CURLOPT_FOLLOWLOCATION => true , CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 , CURLOPT_CUSTOMREQUEST => 'GET' , CURLOPT_HTTPHEADER => array ( 'Content-Type: application/json' , 'X-Shopify-Access-Token: ' . $ access_token , ) , ) ) ; $ result = curl_exec ( $ curl ) ; if ( curl_errno ( $ curl ) ) { echo 'Error:' . curl_error ( $ curl ) ; } $ info = curl_getinfo ( $ curl ) ; curl_close ( $ curl ) ; $ status = false ; if ( $ info [ 'http_code' ] == 200 || $ info [ 'http_code' ] == 201 ) { $ status = true ; } return $ status ; }
Function to check shopify account credentials whether it is exist and valid or not
Function to check shopify account credentials whether it is exist and valid or not