Jump to content

Recommended Posts

I'm trying to Embed the images from Apple into my PHP file.

 

$phpobj = unserialize($response);
if (is_array($phpobj))
{
foreach ($phpobj['value']['items'] AS $key => $val)
{
printf("<div><p><a href=%s>%s</a></p><p>%s</p>\n", $val['link'], $val['title'], $val['description']);
}
}

 

But the problem is that the image attribute is inside a Table and using something lile $val['img'] is not working. So anybody can help me with this.

 

Here is the RSS feed format from which I'm importing

 

 

<item>

	   <title>Dead Awake - Trailer</title>

	   <link>http://trailers.apple.com/trailers/independent/deadawake/</link>

	   <description>DEAD AWAKE is a seductive supernatural thriller starring Rose McGowan, Amy Smart and Nick Stahl set against the backdrop of a mysterious tragedy that shattered their lives a decade ago and which sets them on a path to uncover the truth that lies between the living and the dead.</description>

	   <pubDate>Wed, 01 Dec 2010 00:00:00 PST</pubDate>

		<content:encoded><![CDATA[

		<table>

		<tr valign="top">

		<td width="67"><a href="http://trailers.apple.com/trailers/independent/deadawake/"><img src="http://trailers.apple.com/trailers/independent/deadawake/images/poster.jpg" width="65" height="97" border="0"></a></td>

		<td>   </td>

		<td><a href="http://trailers.apple.com/trailers/independent/deadawake/"><span style="font-size: 16px; font-weight: 900; text-decoration: underline;">Dead Awake - Trailer</span></a><br />

		<span style="font-size: 12px;">DEAD AWAKE is a seductive supernatural thriller starring Rose McGowan, Amy Smart and Nick Stahl set against the backdrop of a mysterious tragedy that shattered their lives a decade ago and which sets them on a path to uncover the truth that lies between the living and the dead.<br /><b>Directed by:</b> Omar Naim<br /><b>Starring:</b> Nick Stahl, Rose McGowan, Amy Smart, Ben Marten, Kim Grimaldi, Brian Lynner, Justin Marxen, James Serpento, Jack Mishler, Shane Simmons, Rachel Storey, Justin Urich, Andrea Leon, Livia Milano, Phyllis Mumford</span></td>

		</tr>

		</table>

		]]></content:encoded>

   </item>

Link to comment
https://forums.phpfreaks.com/topic/220434-embedding-images-from-rss-into-php/
Share on other sites

If you can count on the image being a JPEG then you might be able to get away with using regular expressions to extract the URL from the description.  Use the $val['link'] variable inside the regular expression search string as the jpeg URL seems to reside in the same directory.

But the problem is that the image attribute is within the embed field. So I'm not able to use it. The link, title and description can be used directly as $val['link'], $val['title'], $val['description'] but how can I use the Image??

 

Any help???

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.