Skip to content

Commit e2b2edb

Browse files
sakshamg1304rohitesh-wingify
authored andcommitted
fix: get requests to use cURL for better reliability
1 parent 7250ff5 commit e2b2edb

File tree

4 files changed

+18
-28
lines changed

4 files changed

+18
-28
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.14.0] - 2025-01-XX
9+
10+
### Fixed
11+
12+
- Fixed GET requests (settings calls) to always use cURL instead of sockets for improved reliability.
13+
814
## [1.13.0] - 2025-10-10
915

1016
### Added

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vwo/vwo-fme-php-sdk",
33

4-
"version": "1.13.0",
4+
"version": "1.14.0",
55
"keywords": ["vwo", "fme", "sdk"],
66
"license": "Apache-2.0",
77
"authors": [{

src/Constants/Constants.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Constants {
4040
const DEFAULT_EVENTS_PER_REQUEST = 100;
4141
const SDK_NAME = 'vwo-fme-php-sdk';
4242

43-
const SDK_VERSION = '1.13.0';
43+
const SDK_VERSION = '1.14.0';
4444
const AP = 'server';
4545

4646
const SETTINGS = 'settings';

src/Packages/NetworkLayer/Client/NetworkClient.php

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -263,32 +263,16 @@ public function GET($request)
263263
$responseModel = new ResponseModel();
264264

265265
try {
266-
// Check if we should use cURL instead of socket
267-
if ($this->shouldUseCurl($networkOptions)) {
268-
$curlResponse = $this->makeCurlRequest(
269-
$networkOptions['url'],
270-
'GET',
271-
$networkOptions['headers'],
272-
null,
273-
$networkOptions['timeout'] / 1000
274-
);
275-
$rawResponse = $curlResponse['body'];
276-
$responseModel->setStatusCode($curlResponse['status_code']);
277-
} else {
278-
// Use socket connection (existing logic)
279-
$socket = $this->createSocketConnection(
280-
$networkOptions['url'],
281-
$networkOptions['timeout'] / 1000
282-
);
283-
284-
$parsedUrl = parse_url($networkOptions['url']);
285-
$path = $parsedUrl['path'] . (isset($parsedUrl['query']) ? '?' . $parsedUrl['query'] : '');
286-
287-
$this->sendRequest($socket, 'GET', $path, $networkOptions['headers'], null, $networkOptions['url']);
288-
$rawResponse = $this->readResponse($socket)['body'];
289-
290-
fclose($socket);
291-
}
266+
$curlResponse = $this->makeCurlRequest(
267+
$networkOptions['url'],
268+
'GET',
269+
$networkOptions['headers'],
270+
null,
271+
$networkOptions['timeout'] / 1000
272+
);
273+
$rawResponse = $curlResponse['body'];
274+
$responseModel->setStatusCode($curlResponse['status_code']);
275+
292276

293277
$parsedData = json_decode($rawResponse, false);
294278
if ($parsedData === null && json_last_error() !== JSON_ERROR_NONE) {

0 commit comments

Comments
 (0)