I am so close given everything I have read. Really I have been working on this and trying to understand this for a couple days. Endless google searches, and php manual reading of examples. I just don't think I have hit that AHA! moment where it clicks with me.
I want to get data from js file in anther server.
<?PHP
$token = "123";
//setup the request, you can also use CURLOPT_URL
$ch = curl_init('http://www.123.com/api/channels?limit=100000');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Authorization: Bearer ' . $token
));
$data = curl_exec($ch);
curl_close($ch);
//$xx = json_decode($data, true);
$someArray = json_decode($data, true);
//print_r($someArray);
foreach ($someArray as $key => $value) {
echo $key["id"] . ", " . $key["text"] . "<br>";
}
?>
** tried to parse a JSON file using PHP. But I am stuck now.
This is the content of my JSON file outbout**
{
"code": 100,
"message": "get successfully",
"all": [{
"id": 1,
"image": "http:\/\/www.live-plus.io\/cache\/d7\/23d79957adf9dc7d8e675f0cfa76a55d.png",
"text": "Bein Sport",
"order": 1,
"is_active": 1,
"created_at": "2017-10-22 00:03:08",
"updated_at": "2018-05-08 16:22:53",
"channels": [{
"id": 1,
"name": "bein News",
"image": "http:\/\/www.live-plus.io\/cache\/35\/7835dc385c571b09cbb8caabc07dcdb4.png",
"is_active": 1,
"is_feature": 0,
"order": 1,
"created_at": "2017-10-22 00:03:51",
"updated_at": "2018-01-18 21:22:45",
"pivot": {
"category_id": 1,
"channel_id": 1
},
"servers": [{
"id": 87,
"title": "\u062c\u0648\u062f\u0647 \u0639\u0627\u0644\u064a\u0647",
"url": "redirect\/sport1\/BeinSportNews_source",
"type": 2,
"is_active": 1,
"channel_id": 1,
"server_type_id": 2,
"created_at": "2017-10-22 11:48:56",
"updated_at": "2018-08-17 12:54:26",
"secure_url": "http:\/\/load.live-plus.tv:1935\/redirect\/sport1\/BeinSportNews_source\/?scheme=m3u8&liveplusendtime=1535668918&liveplusstarttime=1535582518&liveplushash=IKcJuqTDez4txx5PLD2-eLPJx07T0UCyCgMJTWqavlg="
}, {
"id": 89,
"title": "\u062c\u0648\u062f\u0647 \u0645\u062a\u0648\u0633\u0637\u0629 (360)",
"url": "redirect\/sport1\/BeinSportNews_360p",
"type": 2,
"is_active": 1,
"channel_id": 1,
"server_type_id": 2,
"created_at": "2017-10-22 11:50:23",
"updated_at": "2018-08-17 12:54:35",
"secure_url": "http:\/\/load.live-plus.tv:1935\/redirect\/sport1\/BeinSportNews_360p\/?scheme=m3u8&liveplusendtime=1535668918&liveplusstarttime=1535582518&liveplushash=3mxu47vfYmQ5EwLoWNd2_Ni-j7hKWEKnc7BTgcVVgOM="
}, {
"id": 659,
"title": "\u062c\u0648\u062f\u0629 \u0636\u0639\u064a\u0641\u0629 (240)",
"url": "redirect\/sport1\/BeinSportNews_240p",
"type": 2,
"is_active": 1,
"channel_id": 1,
"server_type_id": 2,
"created_at": "2018-03-30 14:49:50",
"updated_at": "2018-08-17 12:54:39",
"secure_url": "http:\/\/load.live-plus.tv:1935\/redirect\/sport1\/BeinSportNews_240p\/?scheme=m3u8&liveplusendtime=1535668918&liveplusstarttime=1535582518&liveplushash=HEIr-OaAmNDLE_gqvVPj8-uW6FcaG190ZLDzlNRM6mk="
}
]
}, {
"id": 2,
"name": "bein HD",
"image": "http:\/\/www.live-plus.io\/cache\/7d\/6e7dd27da3b4a9ed33dca15307ba879f.png",
"is_active": 1,
"is_feature": 0,
"order": 2,
"created_at": "2017-10-22 00:04:12",
"updated_at": "2018-01-18 21:24:14",
"pivot": {
"category_id": 1,
"channel_id": 2
},
"servers": [{
"id": 90,
"title": "\u062c\u0648\u062f\u0647 \u0639\u0627\u0644\u064a\u0647",
"url": "redirect\/sport1\/beINSPORTSHD_source",
"type": 2,
"is_active": 1,
"channel_id": 2,
"server_type_id": 2,
"created_at": "2017-10-22 11:50:57",
"updated_at": "2018-08-17 12:54:43",
"secure_url": "http:\/\/load.live-plus.tv:1935\/redirect\/sport1\/beINSPORTSHD_source\/?scheme=m3u8&liveplusendtime=1535668918&liveplusstarttime=1535582518&liveplushash=zziSNmcRfuPO8du2h-u4meRkuLV40G3SBVcGTqVmYUc="
}, {
"id": 92,
"title": "\u062c\u0648\u062f\u0647 \u0645\u062a\u0648\u0633\u0637\u0629 (360)",
"url": "redirect\/sport1\/beINSPORTSHD_360p",
"type": 2,
"is_active": 1,
"channel_id": 2,
"server_type_id": 2,
"created_at": "2017-10-22 11:52:03",
"updated_at": "2018-08-17 12:54:47",
"secure_url": "http:\/\/load.live-plus.tv:1935\/redirect\/sport1\/beINSPORTSHD_360p\/?scheme=m3u8&liveplusendtime=1535668918&liveplusstarttime=1535582518&liveplushash=6JxLzcmNV1wdQN8ltaHaBEBfJz6Q7xwNz2UklshsLuw="
}, {
"id": 661,
"title": "\u062c\u0648\u062f\u0629 \u0636\u0639\u064a\u0641\u0629 (240)",
"url": "redirect\/sport1\/beINSPORTSHD_240p",
"type": 2,
"is_active": 1,
"channel_id": 2,
"server_type_id": 2,
"created_at": "2018-03-30 14:54:13",
"updated_at": "2018-08-17 12:54:52",
"secure_url": "http:\/\/load.live-plus.tv:1935\/redirect\/sport1\/beINSPORTSHD_240p\/?scheme=m3u8&liveplusendtime=1535668918&liveplusstarttime=1535582518&liveplushash=HMIy3NwWgJzMCxp8TCAO55AMhM_QT0DxChNU6nAUyIo="
}
]
}, {
"id": 3,
"name": "Bein Sports 1",
"image": "http:\/\/www.live-plus.io\/cache\/ff\/59ffb0c1f6fc5f230f7afcc750da6f12.png",
"is_active": 1,
"is_feature": 0,
"order": 3,
"created_at": "2017-10-22 00:04:34",
"updated_at": "2018-01-17 17:18:13",
"pivot": {
"category_id": 1,
"channel_id": 3
},
"servers": [{
"id": 1,
"title": "\u062c\u0648\u062f\u0647 \u0639\u0627\u0644\u064a\u0647 (720)",
"url": "redirect\/Beinx1\/bx1_source",
"type": 2,
"is_active": 1,
"channel_id": 3,
"server_type_id": 2,
"created_at": "2017-10-22 00:30:21",
"updated_at": "2018-08-17 18:08:16",
"secure_url": "http:\/\/load.live-plus.tv:1935\/redirect\/Beinx1\/bx1_source\/?scheme=m3u8&liveplusendtime=1535668918&liveplusstarttime=1535582518&liveplushash=85LyxJDxf9i0bU6kioFowv2I-Qon_0xPNb_M9G_kBqM="
}, {
"id": 2,
"title": "\u062c\u0648\u062f\u0629 \u0645\u062a\u0648\u0633\u0637\u0629 (480)",
"url": "redirect\/Beinx1\/bx1_480p",
"type": 2,
"is_active": 1,
"channel_id": 3,
"server_type_id": 2,
"created_at": "2017-10-22 00:33:39",
"updated_at": "2018-08-17 18:08:20",
"secure_url": "http:\/\/load.live-plus.tv:1935\/redirect\/Beinx1\/bx1_480p\/?scheme=m3u8&liveplusendtime=1535668918&liveplusstarttime=1535582518&liveplushash=0vjltj0WknuGZ2ZH5yVdGASflpXN9WtYtZGi-PQdJ-A="
}, {
"id": 3,
"title": "\u062c\u0648\u062f\u0647 \u0645\u062a\u0648\u0633\u0637\u0629 (360)",
"url": "redirect\/Beinx1\/bx1_360p",
"type": 2,
"is_active": 1,
"channel_id": 3,
"server_type_id": 2,
"created_at": "2017-10-22 00:34:14",
"updated_at": "2018-08-17 18:08:24",
"secure_url": "http:\/\/load.live-plus.tv:1935\/redirect\/Beinx1\/bx1_360p\/?scheme=m3u8&liveplusendtime=1535668918&liveplusstarttime=1535582518&liveplushash=S8vjztw7O8vZJfoDqmMWQ8Kd5OXgh624Fz3H1mDOdn0="
}, {
"id": 4,
"title": "\u062c\u0648\u062f\u0647 \u0636\u0639\u064a\u0641\u0629 (240)",
"url": "redirect\/Beinx1\/bx1_240p",
"type": 2,
"is_active": 1,
"channel_id": 3,
"server_type_id": 2,
"created_at": "2017-10-22 00:34:33",
"updated_at": "2018-08-17 18:08:28",
"secure_url": "http:\/\/load.live-plus.tv:1935\/redirect\/Beinx1\/bx1_240p\/?scheme=m3u8&liveplusendtime=1535668918&liveplusstarttime=1535582518&liveplushash=kcIoL7nR7fGRfJ_HoA747nbjiAjphEncaj1JpIJ8_dc="
}, {
"id": 6,
"title": "\u062c\u0648\u062f\u0647 \u0636\u0639\u064a\u0641\u0629 - \u0645\u062e\u0635\u0635\u0647 \u0644\u0644\u0628\u0627\u0642\u0629",
"url": "redirect\/Beinx1\/bx1_160p",
"type": 2,
"is_active": 1,
"channel_id": 3,
"server_type_id": 2,
"created_at": "2017-10-22 00:38:25",
"updated_at": "2018-08-17 18:08:32",
"secure_url": "http:\/\/load.live-plus.tv:1935\/redirect\/Beinx1\/bx1_160p\/?scheme=m3u8&liveplusendtime=1535668918&liveplusstarttime=1535582518&liveplushash=nS6iGwp-kLIOMsIWygOnuamfFq13KKjJhJgJ0i2lAos="
}, {
"id": 7,
"title": "\u062c\u0648\u062f\u0647 \u0639\u0627\u0644\u064a\u0647 (720) \u0645\u0635\u062f\u0631 2",
"url": "redirect\/Beinx3\/x1_source",
"type": 2,
"is_active": 1,
"channel_id": 3,
"server_type_id": 2,
"created_at": "2017-10-22 00:38:47",
"updated_at": "2018-08-17 18:14:34",
"secure_url": "http:\/\/load.live-plus.tv:1935\/redirect\/Beinx3\/x1_source\/?scheme=m3u8&liveplusendtime=1535668918&liveplusstarttime=1535582518&liveplushash=1MuhTMmCh8l8EBcfMrhpRmLt8XbeVCIlwF5zDk6sbfg="
I need to get secure_url by name item