webcams.travel

FREEMIUM
Verified
Por webcams.travel | Atualizado a year ago | Travel
Popularidade

9.9 / 10

Latência

512ms

Nível de serviço

100%

Voltar para todas as discussões

Unirest\Exception' with message 'SSL certificate problem

avatar
italiaskirama
6 years ago

Hello, i’m try to get webcam info by webcams.travel with this code:

$json = Unirest\Request::get(“https://webcamstravel.p.mashape.com/webcams/list/webcam={1200421441}”,
array(
“X-Mashape-Key” => “y7hgww64CLmsh7qHXrrcdgbPSfR0p19fImbjsnjkbTjdAATrzk”,
“Accept” => “application/json”
)
);

data=jsondecode(data = json_decode(json);

I get this error.
Uncaught exception ‘Unirest\Exception’ with message 'SSL certificate problem: unable to get local issuer certificate

if i try to inset this line before the code Unirest\Request::verifyPeer(false);

i get this error Warning: json_decode() expects parameter 1 to be string

How can i solve this problem.

Thanks

avatar
italiaskirama commented 6 years ago

Thanks for all, great support

avatar
webcams.travel commented 6 years ago

Hi

For displaying the webcam or the timelapse player you have to request the image and the timelapse object. You may use this API call: https://webcamstravel.p.mashape.com/webcams/list/webcam=1200421441?show=webcams:image,timelapse

Please refer to the documentation for more information on the available response objects:
https://developers.webcams.travel/#webcams-query-parameter
https://developers.webcams.travel/#webcams-api-webcam-image-object
https://developers.webcams.travel/#webcams-api-webcam-timelapse-object

Regards

avatar
italiaskirama commented 6 years ago

Hi, thanks for the usefull advice,
Now i get the response below for example, but i don’t understand how to show the streaming of the selected webcam . Could you give me some advice? Thanks

Unirest\Response Object ( [code] => 200 [raw_body] => {“status”:“OK”,“result”:{“offset”:0,“limit”:10,“total”:1,“webcams”:[{“id”:“1427829060”,“status”:“active”,“title”:“Simplonpass \u203a North: Simplon Pass”}]}} [body] => stdClass Object ( [status] => OK [result] => stdClass Object ( [offset] => 0 [limit] => 10 [total] => 1 [webcams] => Array ( [0] => stdClass Object ( [id] => 1427829060 [status] => active [title] => Simplonpass › North: Simplon Pass ) ) ) ) [headers] => Array ( [0] => HTTP/1.1 200 OK [Cache-Control] => private [Content-Encoding] => gzip [Content-Type] => application/json; charset=utf-8 [Date] => Wed, 12 Oct 2016 08:22:21 GMT [Server] => Mashape/5.0.6 [Vary] => Accept-Encoding [X-Ban-Group] => wct-api-live [Content-Length] => 146 [Connection] => keep-alive ) )

avatar
webcams.travel commented 6 years ago

Hi

The SSL error may be caused by your local installation of PHP and cURL. Please read the following topic on Stack Overflow: http://stackoverflow.com/questions/24611640/curl-60-ssl-certificate-unable-to-get-local-issuer-certificate

It will work if you inset Unirest\Request::verifyPeer(false); before.

The second error about decoding JSON: the call of Unirest\Request::get(…) already returns the decoded JSON data. You can rightaway use $json without calling json_decode().

Please call the API without curly braces, .i.e. https://webcamstravel.p.mashape.com/webcams/list/webcam=1200421441

Regards
Ingo

Junte-se à discussão - adicione o comentário abaixo:

Efetue login / inscreva-se para postar novos comentários
Avaliação: 5 - Votos: 1