0

I would like to extract the iframe code from a JSON request and display it in an HTML document.

The link is: https://sketchfab.com/oembed?url=https://sketchfab.com/show/a79f6f7b26574baeb58ce392f837c3c7

The iframe code I would like to extract from this link is:

<iframe frameborder=\"0\"\n    width=\"854\"\n    height=\"480\" webkitallowfullscreen=\"true\"\n    mozallowfullscreen=\"true\"\n    src=\"http://sketchfab.com/embed/a79f6f7b26574baeb58ce392f837c3c7?autostart=0&amp;transparent=0&amp;autospin=0&amp;controls=1&amp;watermark=0\"></iframe>

I presume I could do this in PHP and create a variable? I'm not sure how to create the http request and then break up the JSON results.

Any pointers in the right direct would be great.

4

1 回答 1

0

您可以使用 PHP 来json_decode()喜欢:

 <?php
 $file = file_get_contents('https://sketchfab.com/oembed?url=https://sketchfab.com/show/a79f6f7b26574baeb58ce392f837c3c7');
 $stuff = json_decode($file);
 echo $stuff->html;
 ?>
于 2013-11-04T23:49:29.830 回答