Bugreportgitlab
{{#source: php| <?Php
/*******************************************************************/ $api_url = 'https://icube-forge.unistra.fr/api/v3'; $user_token = '***'; $project_id = "37"; $method = "/projects/".$project_id."/issues?private_token=".$user_token; /*******************************************************************/
if(isset($_POST['description'])) {
$description = $_POST['description']; $title = $_POST['description'];
$headers = array( 'Accept: application/json', 'Content-Type: application/json', );
$data_tmp = array( 'user_token' => $user_token, 'title' => $title, 'description' => $description );
$data = json_encode($data_tmp);
$handle = curl_init(); curl_setopt($handle, CURLOPT_URL, $api_url.$method); var_dump($api_url.$method); curl_setopt($handle, CURLOPT_HTTPHEADER, $headers); curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_HEADER, false); curl_setopt($handle, CURLOPT_VERBOSE, true);
curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false);
//curl_setopt($handle, CURLOPT_USERPWD, "login:password"); //curl_setopt($handle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($handle, CURLOPT_POST, true); curl_setopt($handle, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($handle); $code = curl_getinfo($handle, CURLINFO_HTTP_CODE);
var_dump($response);
if($code == 200) { echo $response; }
exit();
} ?>
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title></title>
<form action="index.php" method="post">
<input type="text" name="title" value="Big issue!!"/>
<textarea name="description">Fix me please!!</textarea>
<input type="submit" value="Submit"/>
</form>
</head>
<body>
</body> </html>
}}