I try to scrape a websites HTML code with a guzzle http-request. In the browser (chrome) everything works fine, but when I try to execute the PHP script with the console (windows) I get the following error:
GuzzleHttp\Exception\ConnectException: Connection refused for URI https://example.com
$httpClient = new \GuzzleHttp\Client();
$response = $httpClient->get("https://example.com");
$htmlString = (string) $response->getBody();
- I downloaded "php-7.4.23-nts-Win32-vc15-x64.zip" and extracted it I
- navigated to the folder where I extracted php I ran
php c:\myproject\index.php
source https://stackoverflow.com/questions/69003782/guzzlehttp-exception-connectexception-connection-refused-for-uri
Comments
Post a Comment