error while connecting from API [closed]
Hi
I'm using curl command in php to connect horizon. you can check the error with given link.
http://znetrocks.com/admin/test/openstack/open_stack_2.php
and the code is given below.
$request = ' <auth xmlns="http://103.247.97.1:5000/v2.0/tokens" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <passwordcredentials password="xyz" username="xyz"> </passwordcredentials></auth>';
// Create Headers //$header[] = "Host: http://103.247.97.1:5000/v2.0/tokens%22 (http://103.247.97.1:5000/v2.0/tokens") ; $header[] = "Content-type: text/xml"; //$header[] = "Content-length: ".strlen($request) . "\r\n"; $header[] = $request;
// Send using CURL $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, "http://103.247.97.1:5000/v2.0/tokens"); // URL to post curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); // return into a variable curl_setopt( $ch, CURLOPT_HTTPHEADER, $header ); // headers from above curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,$request);
$result = curl_exec( $ch ); // runs the post print_r($result); curl_close($ch);
?>