{"action":"created","issue":{"url":"https://api.github.com/repos/hotelbeds-sdk/hotel-api-sdk-php/issues/19","repository_url":"https://api.github.com/repos/hotelbeds-sdk/hotel-api-sdk-php","labels_url":"https://api.github.com/repos/hotelbeds-sdk/hotel-api-sdk-php/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/hotelbeds-sdk/hotel-api-sdk-php/issues/19/comments","events_url":"https://api.github.com/repos/hotelbeds-sdk/hotel-api-sdk-php/issues/19/events","html_url":"https://github.com/hotelbeds-sdk/hotel-api-sdk-php/issues/19","id":164637757,"number":19,"title":"Not authorized, review your api-key and secret!","user":{"login":"xochilpili","id":6123199,"avatar_url":"https://avatars.githubusercontent.com/u/6123199?v=3","gravatar_id":"","url":"https://api.github.com/users/xochilpili","html_url":"https://github.com/xochilpili","followers_url":"https://api.github.com/users/xochilpili/followers","following_url":"https://api.github.com/users/xochilpili/following{/other_user}","gists_url":"https://api.github.com/users/xochilpili/gists{/gist_id}","starred_url":"https://api.github.com/users/xochilpili/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xochilpili/subscriptions","organizations_url":"https://api.github.com/users/xochilpili/orgs","repos_url":"https://api.github.com/users/xochilpili/repos","events_url":"https://api.github.com/users/xochilpili/events{/privacy}","received_events_url":"https://api.github.com/users/xochilpili/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hotelbeds-sdk/hotel-api-sdk-php/labels/help%20wanted","name":"help wanted","color":"159818"},{"url":"https://api.github.com/repos/hotelbeds-sdk/hotel-api-sdk-php/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2016-07-09T00:00:39Z","updated_at":"2016-07-10T09:17:17Z","closed_at":null,"body":"Hola a todos; \r\n\r\nHe generado las credenciales desde : https://developer.hotelbeds.com/docs/read/Home\r\ny he intentado usar el php script que se encuentra en la misma página, me he comunicado con uno de los asesores y fue el que me recomendó usar el SDK de hotelbeds, así mismo lo he probado con postman, sin embargo, obtengo el mismo resultado: \r\n\r\n==================================================\r\n**Not authorized, review your api-key and secret!**\r\n==================================================\r\n\r\n¿Podría por favor alguien orientarme?\r\n\r\n\r\nExpongo aquí la configuración de mi php: \r\n\r\n# php --version\r\nPHP 5.6.22 (cli) (built: May 28 2016 10:12:12)\r\n\r\n# pecl info pecl_http\r\nAbout pecl.php.net/pecl_http-2.5.3\r\n\r\n# php -m \r\n[PHP Modules]\r\nbcmath\r\nbz2\r\ncalendar\r\nCore\r\nctype\r\ncurl\r\ndate\r\ndom\r\nereg\r\nexif\r\nfileinfo\r\nfilter\r\nftp\r\ngd\r\ngettext\r\ngmp\r\nhash\r\nhttp\r\niconv\r\njson\r\nldap\r\nlibxml\r\nmbstring\r\nmcrypt\r\nmhash\r\nmssql\r\nmysql\r\nmysqli\r\nopenssl\r\npcntl\r\npcre\r\nPDO\r\npdo_dblib\r\npdo_mysql\r\npdo_pgsql\r\npdo_sqlite\r\npgsql\r\nPhar\r\nposix\r\npropro\r\nraphf\r\nreadline\r\nReflection\r\nsession\r\nshmop\r\nSimpleXML\r\nsoap\r\nsockets\r\nSPL\r\nsqlite3\r\nstandard\r\nsysvmsg\r\nsysvsem\r\nsysvshm\r\ntokenizer\r\nwddx\r\nxml\r\nxmlreader\r\nxmlwriter\r\nxsl\r\nzip\r\nzlib\r\n\r\n# cat HotelApiClient.ini\r\napiclient.url          = https://api.test.hotelbeds.com\r\napiclient.apikey       = **********************\r\napiclient.sharedsecret = **********\r\napiclient.timeout      = 120\r\n\r\n**Usando el SDK **\r\n# cat test.php\r\n\r\n<?php\r\n\trequire __DIR__.'/framework/vendor/autoload.php';\r\n\t\r\nuse hotelbeds\\hotel_api_sdk\\HotelApiClient;\r\nuse hotelbeds\\hotel_api_sdk\\model\\Destination;\r\nuse hotelbeds\\hotel_api_sdk\\model\\Occupancy;\r\nuse hotelbeds\\hotel_api_sdk\\model\\Pax;\r\nuse hotelbeds\\hotel_api_sdk\\model\\Rate;\r\nuse hotelbeds\\hotel_api_sdk\\model\\Stay;\r\nuse hotelbeds\\hotel_api_sdk\\types\\ApiVersion;\r\nuse hotelbeds\\hotel_api_sdk\\types\\ApiVersions;\r\nuse hotelbeds\\hotel_api_sdk\\messages\\AvailabilityRS;\r\n\t\r\n\t$reader = new Zend\\Config\\Reader\\Ini();\r\n\t$config = $reader->fromFile(__DIR__.'/HotelApiClient.ini');\r\n\t$cfgApi = $config['apiclient'];\r\n\r\n\t$apiClient = new HotelApiClient($cfgApi['url'],$cfgApi['apikey'],$cfgApi['sharedsecret'],new ApiVersion(ApiVersions::V1_0), $cfgApi['timeout']);\r\n\t\r\n\t$rqData = new \\hotelbeds\\hotel_api_sdk\\helpers\\Availability();\r\n\t$rqData->stay = new Stay(DateTime::createFromFormat('Y-m-d','2016-07-08'),DateTime::createFromFormat('Y-m-d','2016-07-10'));\r\n\t\r\n\t$rqData->destination = new Destination('PMI');\r\n\t$occupancy = new Occupancy();\r\n\t$occupancy->adults=2;\r\n\t$occupancy->children=1;\r\n\t$occupancy->rooms=1;\r\n\t\r\n\t$occupancy->paxes = [new Pax(Pax::AD, 30, 'Mike', 'Doe'),  new Pax(Pax::AD, 27,'Jane','Doe'),new Pax(Pax::CH, 8, 'Mack','Doe')];\r\n\t$rqData->occupancies = [$occupancy];\r\n\t\r\n\ttry{\r\n\t\t$availRS = $apiClient->availability($rqData);\r\n\t\t\r\n\t}catch(\\hotelbeds\\hotel_api_sdk\\types\\HotelSDKException $e){\r\n\t\t$auditData = $e->getAuditData();\r\n\t\terror_log($e->getMessage());\r\n\t\t//error_log(\"Audit remote data = \".json_encode($auditData->toArray()));\r\n\t\texit();\r\n\t}catch(Exception $e){\r\n\t\terror_log($e->getMessage());\r\n\t\texit();\r\n\t}\r\n\t\r\n\tif(!$availRS->isEmpty()){\r\n\t\tprint_r($availRS->hotels->toArray());\r\n\t}else{\r\n\t\techo \"No results!\\n\\n\";\r\n\t}\r\n?>\r\n\r\n#php test.php\r\nNot authorized, review your api-key and secret!\r\n\r\nAsí mismo, tuve que renombrar AvailabilityRS a availabilityRS en la carpeta messages/\r\nEn el hilo del error documentado en este repositorio, dice que habría que actualizar, sin embargo, no tengo ni una hora que lo he instalado, asumo que me ha instalado la última versión.\r\n\r\n# cat framework/composer.json \r\n{\r\n    \"require\": {\r\n        \"hotelbeds/hotel-api-sdk-php\": \"dev-master@dev\"\r\n    }\r\n}\r\n\r\n**Usando el siguiente script PHP publicado en la página oficial de la documentación**:\r\n<?php\r\n// Your API Key and secret\r\n$apiKey = \"yourApiKey\";\r\n$sharedSecret = \"yourSharedSecret\";\r\n// Signature is generated by SHA256 (Api-Key + Shared Secret + Timestamp (in seconds))\r\n$signature = hash(\"sha256\", $apiKey.$sharedSecret.time());\r\n// Example of call to the API\r\n$endpoint = \"https://api.test.hotelbeds.com/hotel-api/1.0/status\";\r\n$request = new http\\Client\\Request(\"GET\",\r\n    $endpoint,\r\n    [ \"Api-Key\"     => $apiKey,\r\n      \"X-Signature\" => $signature,\r\n      \"Accept\"      => \"application/xml\" ]);\r\ntry{\r\n    $client = new http\\Client;\r\n    $client->enqueue($request)->send();\r\n    // pop the last retrieved response\r\n   $response = $client->getResponse();\r\n    if ($response->getResponseCode() != 200) {  \r\n       printf(\"%s returned '%s' (%d)\\n\",\r\n           $response->getTransferInfo(\"effective_url\"),\r\n           $response->getInfo(),\r\n           $response->getResponseCode()\r\n       );\r\n    } else {\r\n       printf($response->getBody());\r\n    }\r\n} catch (Exception $ex) {\r\n    printf(\"Error while sending request, reason: %s\\n\",$ex->getMessage());\r\n}\r\n?>\r\n\r\n#php test2.php\r\nhttps://api.test.hotelbeds.com/hotel-api/1.0/status returned 'HTTP/1.1 403 Forbidden' (403)\r\n\r\n\r\nLes agradeceré infinitamente su ayuda...\r\n\r\nxOCh"},"comment":{"url":"https://api.github.com/repos/hotelbeds-sdk/hotel-api-sdk-php/issues/comments/231579170","html_url":"https://github.com/hotelbeds-sdk/hotel-api-sdk-php/issues/19#issuecomment-231579170","issue_url":"https://api.github.com/repos/hotelbeds-sdk/hotel-api-sdk-php/issues/19","id":231579170,"user":{"login":"Zavierazo","id":6851912,"avatar_url":"https://avatars.githubusercontent.com/u/6851912?v=3","gravatar_id":"","url":"https://api.github.com/users/Zavierazo","html_url":"https://github.com/Zavierazo","followers_url":"https://api.github.com/users/Zavierazo/followers","following_url":"https://api.github.com/users/Zavierazo/following{/other_user}","gists_url":"https://api.github.com/users/Zavierazo/gists{/gist_id}","starred_url":"https://api.github.com/users/Zavierazo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zavierazo/subscriptions","organizations_url":"https://api.github.com/users/Zavierazo/orgs","repos_url":"https://api.github.com/users/Zavierazo/repos","events_url":"https://api.github.com/users/Zavierazo/events{/privacy}","received_events_url":"https://api.github.com/users/Zavierazo/received_events","type":"User","site_admin":false},"created_at":"2016-07-10T09:17:17Z","updated_at":"2016-07-10T09:17:17Z","body":"Hola @xochilpili . yo creo que estas haciendo todo correctamente pero debe haber algún problema con tus claves. Pásamelas a xortiz@hotelbeds.com y el lunes a primera hora lo reviso."}}
{"actor":{"display_login":"Zavierazo"}}