I have built laravel desktop application and I'm using apis for fetching data from the live server and it is working absolutely fine but when ever i try to upload data from desktop application to live application with api it doesn't work and even does not show any error. when i run same code as web version its working absolutely fine i used curl to upload data from laravel desktop application to live server database here is my curl
$fixtures = Matche::withTrashed()->get();
$matchOfficials = MatchOfficial::all()->groupBy('match_id');
$matchPlayers = MatchPlayer::all()->groupBy('match_id');
$matchDetails = MatchDetail::all()->groupBy('match_id');
$points = Points::all();
$teamRankings = RankingPoints::all();
$followReports = FollowReport::all();
$topKeepers = TopKeeper::all();
$topScorers = TopScorer::all();
$url = 'https://asianhandball.info/symbargo/api/push-fixtures';
$token = csrf_token();
$postData = array(
'fixtures' => $fixtures,
'matchOfficials' => $matchOfficials,
'matchPlayers' => $matchPlayers,
'matchDetails' => $matchDetails,
'points' => $points,
'teamRankings' => $teamRankings,
'followReports' => $followReports,
'topKeepers' => $topKeepers,
'topScorers' => $topScorers
);
// for sending data as json type
$fields = json_encode($postData);
$ch = curl_init($url);
curl_setopt(
$ch,
CURLOPT_HTTPHEADER,
array(
'Content-Type: application/json', // if the content type is json
'bearer: ' . $token // if you need token in header
)
);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
$result = curl_exec($ch);
curl_close($ch);
return $result;
the above mentioned code is used to upload data from laravel desktop application to live server database. Kindly guide me for this Thank you in advance