I have an article posting dashboard website, I send a cURL request from the website that I want to show the article on to the dashboard and it returns data, this is the code I'm using:
public function articleData(Request $request, $text){
$host1 = request()->getHost();
$host = str_replace('www.', '', $host1);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://somedomain.com/getData?host=$host&artURL=".strtolower($text),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
));
$article = curl_exec($curl);
curl_close($curl);
$articles = json_decode($article, true);
return view('Pages.articleTemp')->with('articles', $articles[0]);
}
the issue I'm facing is that when I uploaded it to a live server it stopped returning data which made the website throw an error.
I've tried using this
print curl_error($curl);
it returned this error: SSL certificate problem: self signed certificate
I tried using these inside cURL array:
CURLOPT_SSL_VERIFYHOST
CURLOPT_SSL_VERIFYPEER
nothing worked
it is working perfectly on localhost, this is only on the live server.