I have a problem with the new User Service 2.0.2 Plugin for Openfire and curl. I get with curl an error ‘RequestNotAuthorised’ from the plugin. To check if it’s a problem with the new version a tried it with the old version 1.4.3. No problems here.
I use a plugin for my phpbb forum which registers new users to openfire. I can choose there between curl and fopen. curl isn’t working, fopen works fine with the same paramters. Here is the source code from both functions. Maybe that helps.
/**
- Sends the actual POST request to OpenFire’s UserService using cURL
-
@param string
$url
URL -
@param string[]
$parameters
Parameters -
@return string|false
Callback data from cURL request
*/
private function doRequestCurl($url, $parameters)
{
try {
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL
=> $url . $this->plugin,
CURLOPT_PORT
=> $this->port,
CURLOPT_POST
=> true,
CURLOPT_POSTFIELDS
=> http_build_query($parameters),
CURLOPT_RETURNTRANSFER => true
));
$result = curl_exec ($ch);
curl_close ($ch);
} catch (Exception $ex) {
$result = false;
}
return $result;
}
/**
- Sends the actual POST request to OpenFire’s UserService using cURL
-
@param string
$url
URL -
@param string[]
$parameters
Parameters -
@return string|false
Callback data from FOpen request
*/
private function doRequestFopen($url, $parameters)
{
try {
$fopen = fopen($url . “:” . $this->port . $this->plugin . “?” . http_build_query($parameters), ‘r’);
$result = fread($fopen, 1024);
fclose($fopen);
} catch (Exception $ex) {
$result = false;
}
return $result;
}
Link to the phpbb plugin:
phpBB 3.x API Registration Mod v6+ - EVE Technology Lab - EVE Online Forums