Skip to content

Commit 3221301

Browse files
committed
fix get() method of chatgpt client
1 parent 6468fc9 commit 3221301

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

src/LaravelScrapingBeeChatGpt.php

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,33 +40,15 @@ public function __construct(#[\SensitiveParameter] ?string $apiKey = null)
4040
/**
4141
* @throws ConnectionException
4242
*/
43-
private function request(string $method, string $url, array $data = [], string $postContentType = 'application/x-www-form-urlencoded; charset=utf-8'): Response
43+
public function get(string $url): Response
4444
{
45-
// https://www.scrapingbee.com/documentation/#encoding-url
46-
// urlencode($url) make things fail somehow.
47-
// My guess is urlencode is run at the Http::get() / Http::post() level already
48-
$this->params['url'] = $url;
49-
5045
$this->params['api_key'] = $this->apiKey;
51-
52-
$http = Http::withHeaders($this->headers)->timeout($this->timeout);
53-
54-
$response = $http->get($this->baseUrl, $this->params);
55-
56-
// Reset the params and headers
46+
$response = Http::get($this->baseUrl, $this->params);
5747
$this->reset();
5848

5949
return $response;
6050
}
6151

62-
/**
63-
* @throws ConnectionException
64-
*/
65-
public function get(string $url): Response
66-
{
67-
return $this->request('GET', $url);
68-
}
69-
7052
/**
7153
* https://www.scrapingbee.com/documentation/chatgpt/?fpr=php-laravel#prompt
7254
*/

0 commit comments

Comments
 (0)