powered by Jive Software

S2s connection problem

Hi,

is anyone can tell me how to create connection with server to server. actually my requirement is: my website is on different server(http://example.com) and openfire is on different server(http://example2.com). i m creating user on my website (http://example.com) and also want this user also created on openfire server(http://example2.com) too. for this i m sending my curl request in php. but server not connected. giving error:

2017.06.19 13:50:24 org.jivesoftware.openfire.net.BlockingAcceptingMode - Connect Socket[addr=/182.50.151.56,port=48029,localport=5269]

2017.06.19 13:50:24 org.jivesoftware.openfire.net.BlockingReadingMode - Connection closed before session establishedSocket[addr=/182.50.151.56,port=48029,localport=5269]

please give me the solution.

make sure your port number 5269 is not blocked by firewall or any other applicatoin because server to server connection made through this port and you are getting blocking error so please check your port is open and can be access through openfire.

if you want to change this port you can change it from server properties.

Hi Hiren,

when i direct open my server (http://server.quizo.net/ ) its gives me this error:

This site can’t be reached

or when i try to run with ip: http://185.37.226.102/

Not Found

The requested URL / was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

can u please tell me is it server issues or in my coding issues?

my code is:

$username = “ravi”;

$url = “http://185.37.226.102:9090/plugins/restapi/v1/users/”.$username; // get All Users

$curl = curl_init($url);

curl_setopt($curl, CURLOPT_HEADER, false);

curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

curl_setopt($curl, CURLOPT_PORT, 5269);

curl_setopt($curl, CURLOPT_HTTPHEADER, array(“Accept: application/json”, “Authorization: Basic YaWRtaW46Y5sWRtaW4xMjMKta”));

curl_setopt($curl, CURLOPT_POST, true);

curl_setopt($curl, CURLOPT_CUSTOMREQUEST, “GET”);

$json_response = curl_exec($curl);

$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);

// Check for errors and display the error message

if($errno = curl_errno($curl)) {

$error_message = curl_strerror($errno);

echo “cURL error ({$errno}):\n {$error_message}”;

}

curl_close($curl);

$response = json_decode($json_response);

echo “

”; print_r($response); die(“check status”);

one thing more, this code is working in postman and gives the result.

even when i wrote this code in file_get_contents, in its also work.

but curl is not work. may i know the reason?

with file_get_contents:

<?php $url = "http://185.37.226.102:9090/plugins/restapi/v1/users/vanny"; $options = array( 'http' => array( "method" => "GET", 'header' => array("Accept: application/json", "Authorization: Basic YaWRtaW46Y5sWRtaW4xMjMKta") ), ); $context = stream_context_create($options); //var_dump($context); // Open the file using the HTTP headers set above $result = file_get_contents($url, false, $context); echo "
";

$jsonRes = json_decode($result);

if(isset($jsonRes)){

echo "user exist";

} else {

echo "not exist";

}

?>

your server is runnig fine on Openfire Admin Console

i can easily access plesae try to login with your admin console cradentials.

As i am java developer i cann’t understand the php code so i can not determine is there any issue with your code or not .

Please provide your server to server configuration properties that could better for me to understand id there any mis configuration there or not

Hi Hiren,

pls check below screen shot:

if you need any other details then let me know, i will send you that too. but please resolve my issues asap.