"measures": [{
"symbol": "CP",
"label": "Prohibition except under defined conditions",
"products": [{
"hs_version": "HS-17",
"chapter": "29",
"code": "290377",
"reported_code": "ex 2903 77\u00a0600 0",
"description": "Halogenated derivatives of acyclic hydrocarbons containing two or more different halogens, perhalogenated only with fluorine and chlorine (excl. chlorodifluoromethane, dichlorotrifluoroethanes, dichlorofluoroethanes, chlorodifluoroethanes, dichloropentafluoropropanes, bromochlorodifluoromethane, bromotrifluoromethane and dibromotetrafluoroethanes)",
"reported_description": "CFCl3 (CFC-11) Trichlorofluoromethane",
"interpreted": 0
}, {
"hs_version": "HS-17",
"chapter": "29",
"code": "290379",
"reported_code": "ex 2903 79\u00a0300 0",
"description": "Halogenated derivatives of acyclic hydrocarbons containing two or more different halogens (excl. perhalogenated, and chlorodifluoromethane, dichlorotrifluoroethanes, dichlorofluoroethanes, chlorodifluoroethanes, dichloropentafluoropropanes, bromochlorodifluoromethane, bromotrifluoromethane and dibromotetrafluoroethanes)",
"reported_description": "C3H6FCl (HCFC-271) Chlorofluoropropane",
"interpreted": 0
}]
}, {
"symbol": "NAL-X",
"label": "Non-automatic licensing",
"products": [{
"hs_version": "HS-17",
"chapter": "29",
"code": "290377",
"reported_code": "ex 2903 77\u00a0600 0",
"description": "Halogenated derivatives of acyclic hydrocarbons containing two or more different halogens, perhalogenated only with fluorine and chlorine (excl. chlorodifluoromethane, dichlorotrifluoroethanes, dichlorofluoroethanes, chlorodifluoroethanes, dichloropentafluoropropanes, bromochlorodifluoromethane, bromotrifluoromethane and dibromotetrafluoroethanes)",
"reported_description": "CFCl3 (CFC-11) Trichlorofluoromethane",
"interpreted": 0
}, {
"hs_version": "HS-17",
"chapter": "29",
"code": "290379",
"reported_code": "ex 2903 79\u00a0300 0",
"description": "Halogenated derivatives of acyclic hydrocarbons containing two or more different halogens (excl. perhalogenated, and chlorodifluoromethane, dichlorotrifluoroethanes, dichlorofluoroethanes, chlorodifluoroethanes, dichloropentafluoropropanes, bromochlorodifluoromethane, bromotrifluoromethane and dibromotetrafluoroethanes)",
"reported_description": "C3H6FCl (HCFC-271) Chlorofluoropropane",
"interpreted": 0
}]
}]
$zur[] = json_decode($html['data']['details'], true, 999, JSON_THROW_ON_ERROR);
$headers2 = array(
"Accept: application/json",
"Ocp-Apim-Subscription-Key: 8888888888",
);
$ch2 = curl_init("https://api.wto.org/qr/v1/notifications?locale=en&type=complete-notification&status=published");
function ex_curl_setopt($ch2, int $option2, $val2): void
{
if (!curl_setopt($ch2, $option2, $val2)) {
throw new \RuntimeException("curl_setopt failed: " . curl_errno($ch2) . ":" . curl_error($ch2));
}
}
curl_setopt($ch2, CURLOPT_HTTPHEADER, $headers2);
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
$response2 = curl_exec($ch2);
if(curl_errno($ch2)){
throw new \RuntimeException("curl_exec failed: ".curl_errno($ch2).": ".curl_error($ch2));
}
curl_close($ch2);
$data2 = json_decode($response2, true, 999, JSON_THROW_ON_ERROR);
$rty = [];
foreach ($data2['data'] as $links) {
$rty[] = $links['details'];
}
$multi = curl_multi_init();
$handles = [];
foreach ($rty as $newdata) {
$ch = curl_init ($newdata);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_multi_add_handle ($multi, $ch);
$handles[$newdata] = $ch;
}
do {
$mrc = curl_multi_exec($multi, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
while ( $active && $mrc == CURLM_OK)
{
if (curl_multi_select ($multi)== -1) {
usleep(100);
}
do {
$mrc = curl_multi_exec ($multi, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
}
$zur = [];
foreach ($handles as $channel) {
$html = curl_multi_getcontent($channel);
$zur[] = json_decode($html, true, 999, JSON_THROW_ON_ERROR);
curl_multi_remove_handle ($multi, $channel);
}
curl_multi_close ($multi);
$der = [];
foreach ($zur as $vasya) :
foreach ($vasya['data'] as $vasya2) {
$der[] = $vasya2;
}
endforeach;
$hpk = [];
foreach ($der as $der2){
$hpk[] = $der2['details'];
}
$multi3 = curl_multi_init();
$handles3 = [];
foreach ($hpk as $newdata3) {
$ch3 = curl_init ($newdata3);
curl_setopt($ch3, CURLOPT_HTTPHEADER, $headers2);
curl_setopt($ch3, CURLOPT_RETURNTRANSFER, true);
curl_multi_add_handle ($multi3, $ch3);
$handles3[$newdata3] = $ch3;
}
do {
$mrc3 = curl_multi_exec($multi3, $active3);
} while ($mrc3 == CURLM_CALL_MULTI_PERFORM);
while ( $active3 && $mrc3 == CURLM_OK)
{
if (curl_multi_select ($multi3)== -1) {
usleep(100);
}
do {
$mrc3 = curl_multi_exec ($multi3, $active3);
} while ($mrc3 == CURLM_CALL_MULTI_PERFORM);
}
$tyh = [];
foreach ($handles3 as $channel3) {
$html3 = curl_multi_getcontent($channel3);
$tyh[] = [json_decode($html3, true, 999, JSON_THROW_ON_ERROR),$html3];
curl_multi_remove_handle ($multi3, $channel3);
}
curl_multi_close ($multi3);
var_dump($tyh);
string(3695) "{"data":{"id":6283,"notification_id":1216,"member_name":"New Zealand","member_code":"C554","document_symbol":"G\/MA\/QR\/N\/NZL\/5","qr_serial_number":19,"qr_group":843112046,"measures":[{"symbol":"CP-X","label":"Prohibition except under defined conditions","products":[{"hs_version":null,"chapter":null,"code":null,"reported_code":"Various","description":null,"reported_description":"Birds and other wildlife (any bat or any bird) not being a domestic bird; or any reptile or any amphibian or any terrestrial or freshwater invertebrate specified in Schedule 7 to the Wildlife Act 1953 or any skin; feathers; egg; flesh; or other part of any such species).","interpreted":0},{"hs_version":"HS-12","chapter":"01","code":"010620","reported_code":"0106.20","description":"Live reptiles \"e.g. snakes, turtles, alligators, caymans, iguanas, gavials and lizards\"","reported_description":"Birds and other wildlife (any bat or any bird) not being a domestic bird; or any reptile or any amphibian or any terrestrial or freshwater invertebrate specified in Schedule 7 to the Wildlife Act 1953 or any skin; feathers; egg; flesh; or other part of any such species).","interpreted":0},{"hs_version":"HS-12","chapter":"01","code":"010631","reported_code":"0106.31","description":"Live birds of prey","reported_description":"Birds and other wildlife (any bat or any bird) not being a domestic bird; or any reptile or any amphibian or any terrestrial or freshwater invertebrate specified in Schedule 7 to the Wildlife Act 1953 or any skin; feathers; egg; flesh; or other part of any such species).","interpreted":0},{"hs_version":"HS-12","chapter":"01","code":"010632","reported_code":"0106.32","description":"Live psittaciformes \"incl. parrots, parrakeets, macaws and cockatoos\"","reported_description":"Birds and other wildlife (any bat or any bird) not being a domestic bird; or any reptile or any amphibian or any terrestrial or freshwater invertebrate specified in Schedule 7 to the Wildlife Act 1953 or any skin; feathers; egg; flesh; or other part of any such species).","interpreted":0},{"hs_version":"HS-12","chapter":"01","code":"010639","reported_code":"0106.39","description":"Live birds (excl. birds of prey, psittaciformes, parrots, parrakeets, macaws, cockatoos, ostriches and emus)","reported_description":"Birds and other wildlife (any bat or any bird) not being a domestic bird; or any reptile or any amphibian or any terrestrial or freshwater invertebrate specified in Schedule 7 to the Wildlife Act 1953 or any skin; feathers; egg; flesh; or other part of any such species).","interpreted":0}]}],"administrative_mechanisms":"This measure prohibits the exportation of birds and other wildlife, except with the prior written authority of the Director-General of the Department of Conservation. Administered by the Department of Conservation.","national_legal_bases":"Wildlife Act 1953 ; Wild Animal Control Act 1977; Trade in Endangered Species Act 1989","description":"Conditional prohibition on the exportation of birds and other wildlife","period_from_dt":"01\/10\/2020","period_to_dt":"30\/09\/2022","in_force_dt":"18\/03\/2021","wto_agreements":[{"agreement_code":"026","agreement_source":"GATT","agreement_label":"GATT 1994","agreement_web_link":"http:\/\/www.wto.org\/english\/docs_e\/legal_e\/gatt47_01_e.htm","article_code":"021808","article_element_code":2,"article_description":"XX:(g) - (g) relating to the conservation of exhaustible natural resources if such measures are made effective in conjunction with restrictions on domestic production or consumption;","article_element_label":"BODY","article_footnote":"","article_index":"Article XX:(g)"}],"non_wto_agreements":[]}}"
string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(3980) "{"data":{"id":6288,"notification_id":1216,"member_name":"New Zealand","member_code":"C554","document_symbol":"G\/MA\/QR\/N\/NZL\/5","qr_serial_number":24,"qr_group":631730182,"measures":[{"symbol":"CP-X","label":"Prohibition except under defined conditions","products":[{"hs_version":"HS-17","chapter":"28","code":"28","reported_code":"28","description":"INORGANIC CHEMICALS; ORGANIC OR INORGANIC COMPOUNDS OF PRECIOUS METALS, OF RARE-EARTH METALS, OF RADIOACTIVE ELEMENTS OR OF ISOTOPES","reported_description":"Goods as listed in the New Zealand Strategic Goods List 2019 https:\/\/www.mfat.govt.nz\/assets\/Trade-General\/Brokering-weapons-AND-Trading-weapons-and-controlled-chemicals\/September-2019-NZ-Strategic-Goods-List-reviewed.docx","interpreted":0},{"hs_version":"HS-17","chapter":"29","code":"29","reported_code":"29","description":"ORGANIC CHEMICALS","reported_description":"Goods as listed in the New Zealand Strategic Goods List 2019 https:\/\/www.mfat.govt.nz\/assets\/Trade-General\/Brokering-weapons-AND-Trading-weapons-and-controlled-chemicals\/September-2019-NZ-Strategic-Goods-List-reviewed.docx","interpreted":0},{"hs_version":"HS-17","chapter":"84","code":"84","reported_code":"84","description":"NUCLEAR REACTORS, BOILERS, MACHINERY AND MECHANICAL APPLIANCES; PARTS THEREOF","reported_description":"Goods as listed in the New Zealand Strategic Goods List 2019 https:\/\/www.mfat.govt.nz\/assets\/Trade-General\/Brokering-weapons-AND-Trading-weapons-and-controlled-chemicals\/September-2019-NZ-Strategic-Goods-List-reviewed.docx","interpreted":0},{"hs_version":"HS-17","chapter":"85","code":"85","reported_code":"85","description":"ELECTRICAL MACHINERY AND EQUIPMENT AND PARTS THEREOF; SOUND RECORDERS AND REPRODUCERS, TELEVISION IMAGE AND SOUND RECORDERS AND REPRODUCERS, AND PARTS AND ACCESSORIES OF SUCH ARTICLES","reported_description":"Goods as listed in the New Zealand Strategic Goods List 2019 https:\/\/www.mfat.govt.nz\/assets\/Trade-General\/Brokering-weapons-AND-Trading-weapons-and-controlled-chemicals\/September-2019-NZ-Strategic-Goods-List-reviewed.docx","interpreted":0},{"hs_version":"HS-17","chapter":"90","code":"90","reported_code":"90","description":"OPTICAL, PHOTOGRAPHIC, CINEMATOGRAPHIC, MEASURING, CHECKING, PRECISION, MEDICAL OR SURGICAL INSTRUMENTS AND APPARATUS; PARTS AND ACCESSORIES THEREOF","reported_description":"Goods as listed in the New Zealand Strategic Goods List 2019 https:\/\/www.mfat.govt.nz\/assets\/Trade-General\/Brokering-weapons-AND-Trading-weapons-and-controlled-chemicals\/September-2019-NZ-Strategic-Goods-List-reviewed.docx","interpreted":0},{"hs_version":"HS-17","chapter":"93","code":"93","reported_code":"93","description":"ARMS AND AMMUNITION; PARTS AND ACCESSORIES THEREOF","reported_description":"Goods as listed in the New Zealand Strategic Goods List 2019 https:\/\/www.mfat.govt.nz\/assets\/Trade-General\/Brokering-weapons-AND-Trading-weapons-and-controlled-chemicals\/September-2019-NZ-Strategic-Goods-List-reviewed.docx","interpreted":0}]}],"administrative_mechanisms":"Administered by the Ministry of Foreign Affairs and Trade.","national_legal_bases":"Chemical Weapons (Prohibition) Act 1996; Customs and Excise Act 1996; Customs Export Prohibition Order 2017","description":"Conditional prohibition on the exportation of goods and technologies that can be used in the production; development or use of conventional weapons; nuclear; chemical or biological weapons (strategic goods).","period_from_dt":"01\/10\/2020","period_to_dt":"30\/09\/2022","in_force_dt":"18\/03\/2021","wto_agreements":[{"agreement_code":"026","agreement_source":"GATT","agreement_label":"GATT 1994","agreement_web_link":"http:\/\/www.wto.org\/english\/docs_e\/legal_e\/gatt47_01_e.htm","article_code":"0219","article_element_code":2,"article_description":"Article XXI - Article XXI - Security Exceptions.","article_element_label":"BODY","article_footnote":"","article_index":"Article XXI"}],"non_wto_agreements":[]}}"
string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(0) ""
попробуйте так, посмотрите какие строки туда попадают:
$tyh = [];
foreach ($handles3 as $channel3) {
$html3 = curl_multi_getcontent($channel3);
$tyh[] = json_decode($html3, true, 999, JSON_THROW_ON_ERROR);
curl_multi_remove_handle ($multi3, $channel3);
}
curl_multi_close ($multi3);
var_dump($tyh);
<li>
) с нормативными документами по этой стране и их коротким описанием - это все лежит во втором запросе + из него я забираю url на сам документ и вывожу его в третьем запросе 3) Третий запрос выводит сам документ и его я запихиваю в модальное окно, что бы когда человек нажимал на название документа, у него открывалась модалка с его содержимым. Как то так По коду :
Если я делаю json_decode до закрытия curl оно выводит все элементы, если после то только последний
1) Уберите всю эту хрень вывода под спойлер
2)
Если я делаю json_decode до закрытия curl оно выводит все элементы, если после то только последний
какие элементы? Код давайте, явно вы там какой-то треш намутили.
view-source:https://spo.grsos.com/test6/
- он выводит вот это curl_multi_getcontent($channel);
- в $channel по сути лежит массив url с которых он и забирает данные для каждой из стран$headers2 = array(
"Accept: application/json",
"Ocp-Apim-Subscription-Key: 888888888888",
);
$ch2 = curl_init("https://api.wto.org/qr/v1/notifications?locale=en&type=complete-notification&status=published");
function ex_curl_setopt($ch2, int $option2, $val2): void
{
if (!curl_setopt($ch2, $option2, $val2)) {
throw new \RuntimeException("curl_setopt failed: " . curl_errno($ch2) . ":" . curl_error($ch2));
}
}
curl_setopt($ch2, CURLOPT_HTTPHEADER, $headers2);
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
$response2 = curl_exec($ch2);
if(curl_errno($ch2)){
throw new \RuntimeException("curl_exec failed: ".curl_errno($ch2).": ".curl_error($ch2));
}
curl_close($ch2);
$data2 = json_decode($response2, true, 999, JSON_THROW_ON_ERROR);
$rty = [];
foreach ($data2['data'] as $links) {
$rty[] = $links['details'];
}
$multi = curl_multi_init();
$handles = [];
foreach ($rty as $newdata) {
$ch = curl_init ($newdata);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_multi_add_handle ($multi, $ch);
$handles[$newdata] = $ch;
}
do {
$mrc = curl_multi_exec($multi, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
while ( $active && $mrc == CURLM_OK)
{
if (curl_multi_select ($multi)== -1) {
usleep(100);
}
do {
$mrc = curl_multi_exec ($multi, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
}
foreach ($handles as $channel) {
$html = curl_multi_getcontent($channel);
var_dump($html);
curl_multi_remove_handle ($multi, $channel);
}
curl_multi_close ($multi);
$zur = json_decode($html, true, 999, JSON_THROW_ON_ERROR);
var_dump($zur);
6)
я про то что у меня в 1 массиве есть подмассив например и я не могу просто фильтровать скажем по запятой
array_walk_recursive()
curl_multi_remove_handle($mh, $ch1);
curl_multi_remove_handle($mh, $ch2);
curl_multi_close($mh);
$response1 = curl_multi_getcontent($ch_1);
$response2 = curl_multi_getcontent($ch_2);
$response1 = json_decode($response, true, 999, JSON_THROW_ON_ERROR);
var_dump($response);
<div class="entry-content">
curl_multi_remove_handle($mh, $ch1);
curl_multi_remove_handle($mh, $ch2);
curl_multi_close($mh);
$response1 = curl_multi_getcontent($ch_1);
$response2 = curl_multi_getcontent($ch_2);
var_dump($response1);
<div class="entry-content">
NULL
</div>
'<p>'.
Просто я не знаю есть ли php подобная js команда - что то вроде document.getElementById или by class, если есть что то подобное напишите пожалуйста это бы значимо упростило мне жизнь (
[0] => Array
(
[0] => Имя
[1] => Возраст
)
[1] => Array
(
[0] => Ты кто?
[1] => Сколько лет?
)
[2] => Array
(
[0] => Вася
[1] => 5
)
)
foreach ($qan4 as $repos):
$qan5 .= '<dt><span>'.$repos[0].'</span><div class="acc-icon-wrap parallax-wrap"><div class="acc-button-icon parallax-element"><i class="fa fa-angle-down"></i></div></div></dt><dd class="accordion-content"><h3>Question</h3><dd>'.$repos[1].'</dd><h3>Answer</h3><dd>'.$repos[2].'</dd></div>';
endforeach;