mevdschee/php-sp-api

Stored Procedures with Parameters

Closed this issue · 3 comments

Hi,

I have a stored Procedure with parameters. Can you give me a hint, how the url or my php code have to look? My current code looks like shown in the screenshot down below.

function getModell($herstellerID) {
	$curl = curl_init();

	curl_setopt_array($curl, array(
	  CURLOPT_URL => "http://aw96.de/api.php/getModell",
	  CURLOPT_RETURNTRANSFER => true,
	  CURLOPT_TIMEOUT => 30,
	  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
	  CURLOPT_CUSTOMREQUEST => "GET",
	  CURLOPT_HTTPHEADER => array(
	    "cache-control: no-cache"
	  ),
	));

	return $response = curl_exec($curl);
	$err = curl_error($curl);

	curl_close($curl);
}

Like this:

<?php
function getModell(/*$herstellerID*/) {
	$curl = curl_init();

	curl_setopt_array($curl, array(
	  CURLOPT_URL => "http://aw96.de/api.php/getModell",
	  CURLOPT_RETURNTRANSFER => true,
	  CURLOPT_TIMEOUT => 30,
	  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
	  CURLOPT_CUSTOMREQUEST => "GET",
	  CURLOPT_HTTPHEADER => array(
	    "cache-control: no-cache"
	  ),
	));

	$response = curl_exec($curl);
	$err = curl_error($curl);

	curl_close($curl);
	return json_decode($response);
}

var_dump(getModell());

My Procedere looked Like in the Screenshot shown. Ich have to Pass the variable $herstellerID with the requests. How can I achieve this?

Screenshot_20191115_082732

I found another solution