Conditions | 2 |
Paths | 2 |
Total Lines | 23 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
34 | public function getResponse($url, $body = null, $headers = null) |
||
35 | { |
||
36 | $header = $this->getHeader($headers); |
||
37 | |||
38 | $response = Http::timeout(config('tiktok.tt_timeout')) |
||
39 | ->retry(config('tiktok.tt_retry.number', 1), config('tiktok.tt_retry.time', 200)) |
||
40 | ->withHeaders($header) |
||
41 | ->get($url, $body); |
||
42 | |||
43 | if ($response->failed()) { |
||
44 | return [ |
||
45 | 'success' => false, |
||
46 | 'result' => null, |
||
47 | 'info' => __('tiktok::tiktok.error_data'), |
||
48 | ]; |
||
49 | } |
||
50 | |||
51 | $answer = $response->json(); |
||
52 | |||
53 | return [ |
||
54 | 'success' => true, |
||
55 | 'result' => $answer, |
||
56 | 'info' => '', |
||
57 | ]; |
||
60 |