D
D
Dmitriy2020-11-23 14:08:01
Laravel
Dmitriy, 2020-11-23 14:08:01

What is the problem with the API?

I am accessing a third party API from my Laravel server.
First way:
I call from php artisan tinker, I get the correct answer, such as I need
Second way:
On the front I click on the button, it sends a request to my backend, which in turn sends a request to this API and in this case receives the answer "disallowed" .
On LAN, the second method works fine.
What could be the problem?

Literally a week ago everything was working

API request code.

$domain = $request->query('protocol') . "://" . $request->query('domain');
$url = self::SEORANK_API_MOZ_ALEXA_SEMRUSH . env('SEO_RANK_API_KEY') . '/' . $domain;
$response = Http::get($url);
return $response;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jazzus, 2020-11-24
@jazzus

In such situations, they work closely with the code:
Debug everything in a row
Check credentials (may be different on the production)
Check the logic of requests to api. For example, the paypal sdk has different classes for connecting to prod / dev and what works on localhost will not work on prod with the same credentials.
View api docks
Communicate with tp api
env('SEO_RANK_API_KEY') remove in config and call config
ps magic is definitely not worth waiting for.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question