Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>try this</p> <pre><code>&lt;?php $photo_link = explode( "news", $link ); $first = $photo_link[0]; $last = str_replace( basename( $photo_link[1] ), urlencode( basename( $photo_link[1] ) ), $photo_link[1] ); $photo_link = $first."news".$last; print_r( file_get_contents( $photo_link, false, $context ) ); ?&gt; </code></pre> <p>so your full code will be something like this</p> <pre><code>&lt;?php $feed = array(); $rss = new DOMDocument(); $rss-&gt;load( 'http://isna.ir/fa/Sports/feed' ); foreach( $rss-&gt;getElementsByTagName( 'item' ) as $node ) { $feed[] = array( 'title' =&gt; str_replace( " &amp; ", " &amp;amp; ", $node-&gt;getElementsByTagName( 'title' )-&gt;item(0)-&gt;nodeValue ), 'category' =&gt; $node-&gt;getElementsByTagName( 'category' )-&gt;item(0)-&gt;nodeValue, 'link' =&gt; $node-&gt;getElementsByTagName( 'link' )-&gt;item(0)-&gt;nodeValue, 'date' =&gt; strtotime( $node-&gt;getElementsByTagName( 'pubDate' )-&gt;item(0)-&gt;nodeValue ) ); } $title = $feed[0]["title"]; $link = $feed[0]["link"]; $category = $feed[0]["category"]; $date = date( "l F d, Y", $feed[0]["date"] ); print_r( $feed ); $context = stream_context_create( array( 'http' =&gt; array( 'header' =&gt; 'Connection: close' ) ) ); $f = explode( "news", $link ); /** My Code Starts **/ $f[1] = str_replace( basename( $f[1] ), urlencode( basename( $f[1] ) ), $f[1] ); /** My Code Ends **/ $photo_link = $f[0]."photo".$f[1]; $ff = file_get_contents( $photo_link, false, $context ); $f1 = explode( '&lt;div class="news-image"&gt;', $ff ); $f2 = explode( '&lt;h1', $f1[1] ); $f3 = explode( 'href="', $f2[0] ); $f4 = explode( '"&gt;', $f3[1] ); $image = $f4[0]; echo '&lt;img src="'.$image.'"&gt;&lt;/img&gt;'; ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload