Closed eqcq closed 3 months ago
HI,
I'm trying to retrieve data from the API with PHP and it seems something go wrong :
`<?php
$curl = curl_init();
curl_setopt_array($curl, [ CURLOPT_URL => "https://api.astronomyapi.com/api/v2/bodies/positions?longitude=-84.39733&latitude=33.775867&elevation=1&from_date=2024-05-31&to_date=2024-05-31&time=18%3A01%3A04", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => [ "Authorization: Basic myauth" ], ]);
$response = curl_exec($curl); $err = curl_error($curl);
curl_close($curl);
if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }`
nothing is displayed, not even an error message. It's probably due to my ignorance, but I can't figure what is going wrong
Thanks for all and the API
That's my bad, there was an issue on my server with cURL.
HI,
I'm trying to retrieve data from the API with PHP and it seems something go wrong :
`<?php
$curl = curl_init();
curl_setopt_array($curl, [ CURLOPT_URL => "https://api.astronomyapi.com/api/v2/bodies/positions?longitude=-84.39733&latitude=33.775867&elevation=1&from_date=2024-05-31&to_date=2024-05-31&time=18%3A01%3A04", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => [ "Authorization: Basic myauth" ], ]);
$response = curl_exec($curl); $err = curl_error($curl);
curl_close($curl);
if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }`
nothing is displayed, not even an error message. It's probably due to my ignorance, but I can't figure what is going wrong
Thanks for all and the API