cancel
Showing results for 
Search instead for 
Did you mean: 

writing a constructor

writing a constructor

I have to following code I would like to make a function with a constructor but have no idea how to do it

$OstendoUrl = 'http://<server>:85?script=WebServiceSQL&tablename=ITEMMASTER&format=json&keyfield=ITEMCODE&condition1a=ITEMCODE Like &condition1b=*SPS*&condition2a=ITEMSTATUS = &condition2b=Active&condition3a=EXCLUDEFROMWEB = &condition3b=0&apikey=' .urlencode('');
$ch = curl_init($OstendoUrl);
curl_setopt_array($ch, [
	CURLOPT_RETURNTRANSFER => 1,
    	CURLOPT_HEADER => 0,
    	CURLOPT_PORT => 85,
    	CURLOPT_TIMEOUT => 30,
    	CURLOPT_AUTOREFERER => 1,
    	CURLOPT_FOLLOWLOCATION => true,
		CURLOPT_HTTPHEADER => [
    		'Content-Type' => 'text/html; charset=ISO-8859-1',
    		'User-Agent' => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)',
    		'Connection' => 'Keep-Alive'
    	]
]);
$response = curl_exec($ch);
$json_response = json_decode($response, true);

Any help would be greatly appreciated.

 

Regards

Kevin Marshall