Make(integormat) convert scenario to PHP script (parse api to mysql) -- 2

Job ID: 35618043

Budget: $30 – $250 USD

I have a scenario running that I need converted to PHP class.
The scenario fetches API sportsfeed and goes to repeat to mysql insert queries in different tables.
API requires head auth and parameters, mysql is default
All inserts must have IF Exists UPDATE

Post parameters include changes to DATE fields when sent and received
Post current date+1day change
Headers : APi key and HOST
Fields : Date status league season
MySQL
Sample For each result ::
INSERT INTO game_tournaments
(ID, category_id,name, logo, country, status, created_at, updated_at)
VALUES
('{{2.league.id}}','1',"{{2.league.name}}",'{{2.league.logo}}','{{2.league.country}}','1', '', '')
ON DUPLICATE KEY UPDATE
ID ='{{2.league.id}}',
category_id = '1',
name = "{{2.league.name}}",
logo = '{{2.league.logo}}',
country= '{{2.league.country}}',
status = '1',
created_at = '{{now}}',
updated_at = '{{now}}'
;

Again for :
INSERT INTO game_teams
(id,name,image,status,category_id)
VALUES
('{{2.teams.home.id}}', "{{2.teams.home.name}}", "{{2.teams.home.logo}}", '1', '1')
ON DUPLICATE KEY UPDATE
id='{{2.teams.home.id}}',
name = "{{2.teams.home.name}}",
image = '{{2.teams.home.logo}}',
status = '1',
category_id = '1'
;

INSERT INTO game_teams
(id,name,image,status,category_id)
VALUES
('{{2.teams.away.id}}', "{{2.teams.away.name}}", "{{2.teams.away.logo}}", '1', '1')
ON DUPLICATE KEY UPDATE
id='{{2.teams.away.id}}',
name = "{{2.teams.away.name}}",
image = '{{2.teams.away.logo}}',
status = '1',
category_id = '1'
;
Then GAME MATCHES

INSERT INTO game_matches
(id,category_id,tournament_id,team1_id,team2_id,name,start_date,end_date,status,is_unlock)
VALUES
('{{2.fixture.id}}','1','{{2.league.id}}','{{2.teams.home.id}}','{{2.teams.away.id}}','{{2.fixture.id}}','{{formatDate(now; "YYYY-MM-DD HH:mm")}}','{{formatDate(2.fixture.date; "YYYY-MM-DD HH:mm")}}','1','0')
ON DUPLICATE KEY UPDATE
id ='{{2.fixture.id}}',
category_id ='1',
tournament_id ='{{2.league.id}}',
team1_id ='{{2.teams.home.id}}',
team2_id ='{{2.teams.away.id}}',
name ='{{2.fixture.id}}',
start_date ='{{formatDate(now; "YYYY-MM-DD HH:mm")}}',
end_date ='{{formatDate(2.fixture.date; "YYYY-MM-DD HH:mm")}}',
status ='1',
is_unlock ='0'
;

After the first loop ends :
Fetch API again using FIXTURE ID :: Get ODDS

Insert into Questions table :
Change date again to the below format
Change ID to {{2.fixture.id}}{{39.id}} < second ID is specific bet ID from api

Loop into Options Table Finally for each question ID to post odds

Use {{2.fixture.id}} again
Question ID :{{2.fixture.id}}{{39.id}}
Each option name uses {{46.value}} from second api pull
and odds : {{46.odd}}

{{formatDate(2.fixture.date; "YYYY-MM-DD HH:mm")}}
Related categories: PHP JavaScript MySQL JSON API