Answer the question
In order to leave comments, you need to log in
How to embed JSON in WordPress?
Good afternoon! Reply to the user, please. Need to integrate API (JSON) into WordPress site. No matter how hard you try, it doesn't work. Through the plugin "Json Content Importer" nonsense comes out. At the moment this is the code:
procedure TForm1.Button3Click(Sender: TObject);
var
url, html : String;
begin
url := 'https://steampay.com/api/products';
html := TFPCustomHTTPClient.SimpleGet(url);
memo1.Text := trim(html);
procedure TForm1.Button1Click(Sender: TObject);
var
J: TJSONData;
begin
J:=GetJSON(Memo1.text); //Место где мы берем данные, в моем случаем это Memo1
Memo2.Text:=J.FindPath(Edit1.Text).AsString; //Куда копируем результат, и путь до значение которое требуется
J.Free; //Не забываем освобождать память, иначе будут утечки...
end;
$getjson url=https://steampay.com/api/products';
Answer the question
In order to leave comments, you need to log in
Json is just a data format, a bus that carries your data, work like with a regular object / array.
Drop off the contents of the bus and do what you want
$data = file_get_contents( 'https://steampay.com/api/products' );
if ( ! empty( $data ) ) {
$args = json_decode( $data );
foreach ( $args->products as $one_product ) {
echo $one_product->title . '<br>';
}
}
You need to embed JSON in PHP
Or here is another Yandex article on this topic
to help on this issue ..
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question