Problem with cURL and the User Service Plugin?

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

Hey,

RequestNotAuthorised means that the secret key is wrong or the IP address is blacklisted.

Do you use maybe some special characters in your secret key? (Maybe curl escape other as fopen)

My secret key has special characters. I just tried it with a very simple “Hallo” as secret key after your post:) Same result.

Hey there, 0mni from EVE.

I just recently setup phpBB and used your mod as a starting base for our alliance’s website.

You can see how I solved the problem with Openfire UserService plugin v2+.

https://almostawesome.org/download/openfire_userservice.txt