An error when try to connect SOAP API in ver. 1.3

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
Posts: 16
Joined: 05 Jan 2014, 14:57

An error when try to connect SOAP API in ver. 1.3

Post by rsoft »

Dear friends,
I try to connect to SOAP API via PHP for get response in JSON format with this code on Apache/2.4.23 (Win64) OpenSSL/1.0.2h PHP/7.0.10.
and I get: "Could not connect to host" error.
I'm newbie in web service usage and don't know what should I do?
please help me.
This is my code:

Code: Select all


define('MANTISCONNECT_URL', 'https://localhost/peirang/api/soap/mantisconnect.php');
define('USERNAME', 'xxx');
define('PASSWORD', 'xxx');

parse_str($_SERVER['QUERY_STRING'], $args);
if (!isset($args['name'])) {
  die("No name specified.");
$function_name = $args['name'];
$args = array_merge(
      'username' => trim(USERNAME),
      'password' => trim(PASSWORD)

try {
  $client = new SoapClient(null,array('uri'=> MANTISCONNECT_URL . '?wsdl','location'=> MANTISCONNECT_URL . '?wsdl','trace'=>True));
  $result = $client->__soapCall($function_name, $args);
} catch (SoapFault $e) {
  $result = array(
      'error' => $e->faultstring
print json_encode($result);
Post Reply