Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php XML提要上使用的get_file_内容返回的URL数据出现问题_Php_Xml_File Get Contents - Fatal编程技术网

Php XML提要上使用的get_file_内容返回的URL数据出现问题

Php XML提要上使用的get_file_内容返回的URL数据出现问题,php,xml,file-get-contents,Php,Xml,File Get Contents,我正在使用file\u get\u contents()检索xml提要数据以进行解析。然而,使用图像URL,我得到的基本URL前缀是图像URL-如下所示:- 这是我的密码: <? php $context = stream_context_create( array( 'http' => array( 'follow_location' => false ) ) ); $content =file_get_contents("http://xy

我正在使用
file\u get\u contents()
检索xml提要数据以进行解析。然而,使用图像URL,我得到的基本URL前缀是图像URL-如下所示:-

这是我的密码:

<? php
$context = stream_context_create(
array(
    'http' => array(
        'follow_location' => false
    )
)
);
$content =file_get_contents("http://xyogasangeetax.api.channel.livestream.com/2.0/latestclips.xml", false, $context);
$data = new SimpleXmlElement($content);
foreach($data->channel->item as $entry)
{
if ($media = $entry->children('media', TRUE)) {
$attributes = $media->content->attributes();
$src = $play_attributes['url'];
if ($media->thumbnail) {
$attributes = $media->thumbnail->attributes();
$imgsrc = (string)$attributes['url'];
echo "<img src=\"'$imgsrc'\" alt=\"\" \/>";
}
}
$pub_date= explode("-",$entry->pubDate);
echo date('F d,Y',strtotime(trim($pub_date[0])));
}
?>  

请删除不需要的引号:

改变

echo "<img src=\"'$imgsrc'\" alt=\"\" \/>";
echo "<img src=\"$imgsrc\" alt=\"\" \/>";
echo”“;

echo”“;