Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sarun Mungthanya
SpnPatch-Laravel
Commits
1e3249a2
Commit
1e3249a2
authored
Nov 13, 2024
by
Chanon.u
Browse files
Fix issue send cURL with unverify SSL
parent
3c6e6e4a
Changes
1
Show whitespace changes
Inline
Side-by-side
app/Http/Controllers/ManualResponse/SpnConfigController.php
View file @
1e3249a2
...
@@ -18,8 +18,6 @@ class SpnConfigController extends Controller
...
@@ -18,8 +18,6 @@ class SpnConfigController extends Controller
curl_setopt
(
$ch
,
CURLOPT_URL
,
"
$link
/spn/login_api.php"
);
curl_setopt
(
$ch
,
CURLOPT_URL
,
"
$link
/spn/login_api.php"
);
curl_setopt
(
$ch
,
CURLOPT_POST
,
1
);
curl_setopt
(
$ch
,
CURLOPT_POST
,
1
);
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
true
);
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
true
);
curl_setopt
(
$ch
,
CURLOPT_SSL_VERIFYPEER
,
false
);
// Disable peer verification
curl_setopt
(
$ch
,
CURLOPT_SSL_VERIFYHOST
,
false
);
// Disable host verification
// Set the Authorization header for Basic Auth
// Set the Authorization header for Basic Auth
curl_setopt
(
$ch
,
CURLOPT_HTTPHEADER
,
[
curl_setopt
(
$ch
,
CURLOPT_HTTPHEADER
,
[
...
@@ -32,6 +30,14 @@ class SpnConfigController extends Controller
...
@@ -32,6 +30,14 @@ class SpnConfigController extends Controller
$httpCode
=
curl_getinfo
(
$ch
,
CURLINFO_HTTP_CODE
);
$httpCode
=
curl_getinfo
(
$ch
,
CURLINFO_HTTP_CODE
);
//dd($response, $error, $httpCode); //Debug response of cURL
//dd($response, $error, $httpCode); //Debug response of cURL
if
(
$error
)
{
curl_setopt
(
$ch
,
CURLOPT_SSL_VERIFYPEER
,
false
);
// Disable peer verification
curl_setopt
(
$ch
,
CURLOPT_SSL_VERIFYHOST
,
false
);
// Disable host verification
$response
=
curl_exec
(
$ch
);
$error
=
curl_error
(
$ch
);
// Check for errors
$httpCode
=
curl_getinfo
(
$ch
,
CURLINFO_HTTP_CODE
);
}
curl_close
(
$ch
);
// Close the cURL handle
curl_close
(
$ch
);
// Close the cURL handle
if
(
$httpCode
==
'404'
){
if
(
$httpCode
==
'404'
){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment