<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>php code &#8211; ScriptNet Solutions Blog</title>
	<atom:link href="https://blog.scriptnet.net/tag/php-code/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.scriptnet.net</link>
	<description>Official News, Product Updates, Status and more</description>
	<lastBuildDate>Wed, 19 Aug 2026 15:23:35 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.5</generator>
	<item>
		<title>SneakPeek Script: what it is and why it matters</title>
		<link>https://blog.scriptnet.net/sneakpeek-script-what-it-is-and-why-it-matters/</link>
		
		<dc:creator><![CDATA[Team ScriptNet]]></dc:creator>
		<pubDate>Wed, 19 Aug 2026 15:21:07 +0000</pubDate>
				<category><![CDATA[ScriptNet News]]></category>
		<category><![CDATA[ScriptNet Products]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[API examples]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[custom screenshots]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[generate pdf]]></category>
		<category><![CDATA[generate screenshot]]></category>
		<category><![CDATA[jwt]]></category>
		<category><![CDATA[node]]></category>
		<category><![CDATA[node.js]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php code]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[screenshots]]></category>
		<category><![CDATA[sneakpeek]]></category>
		<category><![CDATA[sneakpeek suite]]></category>
		<category><![CDATA[sneakpeek wp]]></category>
		<category><![CDATA[standalone]]></category>
		<category><![CDATA[superior rendering]]></category>
		<category><![CDATA[url to image]]></category>
		<category><![CDATA[url to pdf]]></category>
		<category><![CDATA[wkhtml]]></category>
		<category><![CDATA[wkhtmltoimage]]></category>
		<category><![CDATA[wkhtmltopdf]]></category>
		<category><![CDATA[WP Plugin]]></category>
		<guid isPermaLink="false">https://blog.scriptnet.net/?p=531</guid>

					<description><![CDATA[SneakPeek Suite is a platform that turns any URL into a branded image or PDF, available through a user interface or a REST API. It is designed for Web Developers and Teams who need reliable visual representations of external web pages like journalists, webmasters, marketing agencies, directories and news portals for example. The core idea [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong><a href="https://scriptnet.net/sneakpeek" rel="noopener" title="Discover SneakPeek Standalone Script" target="_blank">SneakPeek Suite</a></strong> is a platform that <strong>turns any URL into a branded image or PDF</strong>, available <strong>through a user interface or a REST API</strong>. It is designed for Web Developers and Teams who need reliable visual representations of external web pages like journalists, webmasters, marketing agencies, directories and news portals for example. The core idea is straightforward: provide a clean, customizable snapshot of a link that can be embedded in pages, reports or automated workflows or even show external link previews on WP Websites.<br />
<span id="more-531"></span><br />
<figure id="attachment_532" aria-describedby="caption-attachment-532" style="width: 800px" class="wp-caption aligncenter"><img fetchpriority="high" decoding="async" src="https://blog.scriptnet.net/wp-content/uploads/2026/08/sneakpeekV3-6.png" alt="SneakPeek Suite v3.2" width="800" height="400" class="size-full wp-image-532" srcset="https://blog.scriptnet.net/wp-content/uploads/2026/08/sneakpeekV3-6.png 800w, https://blog.scriptnet.net/wp-content/uploads/2026/08/sneakpeekV3-6-300x150.png 300w, https://blog.scriptnet.net/wp-content/uploads/2026/08/sneakpeekV3-6-768x384.png 768w" sizes="(max-width: 800px) 100vw, 800px" /><figcaption id="caption-attachment-532" class="wp-caption-text">SneakPeek Suite v3.2</figcaption></figure><br />
<strong>What’s new in v3.2 (2026)</strong><br />
The v3.2 release focuses on stability, scalability and cleaner architecture rather than flashy features.<br />
Key improvements include:</p>
<ul>
<li><strong>Complete refactoring of backend and user interface</strong> to make the codebase easier to maintain and extend</li>
<li>Soft shutdown logic for the cluster that allows nodes to stop gracefully without interrupting ongoing jobs</li>
<li>Improved ad-blocking logic to remove popups, banners and other invasive elements that spoil captures</li>
<li>Bootstrap and global configuration optimizations that refine the user experience and central settings management</li>
<li>Updated packages and small performance tweaks for better security and compatibility</li>
<p>These changes are aimed at reducing operational risk and <strong>improving reliability under real production loads</strong></li>
</ul>
<p><strong>Who it’s for and how it’s used</strong><br />
<strong><a href="https://blog.scriptnet.net/discover-sneakpeek-v3-the-complete-solution-for-screenshots-and-custom-pdfs/">SneakPeek</a></strong> is built for workflows that require mass or integrated generation of images and PDFs from URLs:</p>
<ul>
<li>REST API for seamless integration with external applications</li>
<li>User-friendly interface for manual operations and file management</li>
<li>WordPress plugin to display branded link previews directly on sites</li>
<li>Advanced resource controls to handle high request volumes without wasting CPU or memory</li>
</ul>
<p>The platform supports adding a logo to every output, setting quality and dimensions, and applying filters to exclude unwanted elements from captures.</p>
<p><strong>A step forward from the past: goodbye wkhtml</strong><br />
The <strong>wkhtmltopdf and wkhtmltopdf solution is no longer supported</strong> or sold in the shop. Technical notes remain in the <strong><a href="https://support.scriptnet.net/knowledgebase.php?category=10" rel="noopener" title="ScriptNet knowledge base" target="_blank">knowledge base</a></strong> for historical reference, but wkhtml is no longer recommended. The current architecture, based on Node.js, delivers superior rendering quality, flexibility and resilience. The difference is clear: <strong>modern rendering and cluster management</strong> outperform legacy addons that have reached their limits.</p>
<p><strong>SneakPeek v3.2</strong> is an update that prioritizes robustness and control behind the scenes. If your work depends on consistent previews, branded PDFs or automated integrations with external sites, this release reduces operational friction and makes large-scale generation more predictable and manageable.<br />
<strong><br />
<a href="https://shop.scriptnet.net/product/sp3" rel="noopener" title="Buy SneakPeek V3.2">Buy it now</a> and start generating!</strong></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Displaying an RSS Feed on a Web Page</title>
		<link>https://blog.scriptnet.net/displaying-an-rss-feed-on-a-web-page/</link>
		
		<dc:creator><![CDATA[Team ScriptNet]]></dc:creator>
		<pubDate>Tue, 24 Sep 2024 16:59:00 +0000</pubDate>
				<category><![CDATA[Life as a Developer]]></category>
		<category><![CDATA[code examples]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[developer choice]]></category>
		<category><![CDATA[developers]]></category>
		<category><![CDATA[feed]]></category>
		<category><![CDATA[feed image]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php code]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[rss feed]]></category>
		<category><![CDATA[rss image]]></category>
		<category><![CDATA[rss reader]]></category>
		<category><![CDATA[rss viewer]]></category>
		<category><![CDATA[web page]]></category>
		<guid isPermaLink="false">https://blog.scriptnet.net/?p=248</guid>

					<description><![CDATA[The Flow of Information today is Everything. We have become such an incredibly Interconnected Society, that we don&#8217;t even realize it. Phones, Web, Social Media&#8230; but also Automation in your Home, Surveillance systems&#8230; even your Car, in some way receives and shares information of some kind. In some ways it&#8217;s a good thing&#8230; in other [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>The Flow of Information today is <strong>Everything</strong>.<br />
We have become such an incredibly <em>Interconnected Society</em>, that we don&#8217;t even realize it. Phones, Web, Social Media&#8230; but also Automation in your Home, Surveillance systems&#8230; even your Car, in some way receives and shares information of some kind. In some ways it&#8217;s a good thing&#8230; in other things maybe it would be appropriate to create a more in-depth discussion in other places.</p>
<p>Anyway, the Topic of this Article dedicated to Webmasters is as the title suggests, how to <strong>implement and display</strong> an <strong><a href="https://en.wikipedia.org/wiki/RSS" rel="noopener" target="_blank">RSS Feed</a></strong> on a Web page. But let&#8217;s start from the beginning.</p>
<p><span id="more-248"></span></p>
<p><strong>What is an RSS or Feed</strong></p>
<p>We are talking about a dedicated System with the anachronism of &#8220;<strong>Really Simple Syndication</strong>&#8220;; or more simply, a File or Code that <strong>automatically Updates information from a Source</strong>, <strong>transforming it into XML format</strong>.</p>
<p>Today this method is extremely popular and is used practically everywhere, from Google to the simplest Blogs, where this <strong>function is native</strong>. An RSS feed takes the headlines, summaries, and update notices, and then links back to Articles on your favorite website’s page. And its peculiarity is that all this <strong>happens in Real Time</strong>.</p>
<p>After this short and quick description, let&#8217;s analyze for a moment, <strong>why you want to implement this RSS on a Web page</strong>.</p>
<p>One reason, given the Native Interaction with the News extracted in real time, is to show the Users of your Website, always <strong>new and updated content</strong>.<br />
It is not something to be taken lightly, especially for static websites created for example as a &#8220;showcase&#8221; without particular functions. It can help <strong>increase the SEO</strong> of the page / site as well as maintaining the freshness of the information that is provided. Another reason could be to integrate external content, to the topic of your page. For example, in a section of your site you talk about cooking recipes, and at the end of your article, you can add a feed with the latest news dedicated to this topic.<br />
These are just a few examples.</p>
<p>So, now let&#8217;s try to explain how to <strong>integrate an RSS Feed on your PHP page</strong>, in a few minutes.</p>
<p>First, let&#8217;s create a little Style, so that the visualization makes sense and adapts to the graphics without breaking them; a good idea is to enclose this snippet in a &lt;/div&gt; or a &lt;section&gt; of the page, where there are already some CSS rules, so that there can be a graphic continuity.</p>
<p><code></p>
<pre>

&lt;style&gt;
body
#wrapper
{
 text-align:center;
 margin:0 auto;
 padding:0px;
 width:80%;
}
#wrapper h1
{
 margin-top:100px;
 font-size:40px;
}
#wrapper h1 p
{
 font-size:17px;
}
#wrapper #feed_div
{
 background-color:white;
 width:auto;
 height:250px;
 overflow-y:scroll;
 margin-left:auto;
 margin-top:20px;
 text-align:left;
 border:1px solid gray;
 padding:10px;
}
#wrapper #feed_div h2
{
 font-size:17px;
}
#wrapper #feed_div .title a
{
 text-decoration:none;
 color:#0080FF;
}
&lt;/style&gt;

</pre>
<p></code></p>
<p>This is a basic way to display the Feed inside a wrapper on your page; it&#8217;s just an example that you can modify as you like; but it&#8217;s a good starting point. Now let&#8217;s add the &#8220;core&#8221; of the snippet:</p>
<p><code></p>
<pre>

&lt;section&gt;
&lt;div id=&quot;wrapper&quot;&gt;
&lt;div id=&quot;feed_div&quot;&gt;
&lt;?php
$rss = simplexml_load_file(&#039;https://blog.scriptnet.net/feed&#039;); //Add your own Feed Source
echo &lt;&#039;h2&gt;.&nbsp; $rss-&gt;channel-&gt;title . &lt;/h2&gt;;
foreach ($rss-&gt;channel-&gt;item as $item) 
{
 echo &lt;&#039;p class=&quot;title&quot;&gt;&lt;a href=&quot;&lt;?= $item-&gt;link ?&gt;&quot;&gt;&lt;?= $item-&gt;title ?&gt;&lt;/a&gt;&lt;/p&gt;;
 echo &lt;p class=&#039;desc&#039;&gt;&lt;?= $item-&gt;description ?&gt;&lt;/p&gt;;
} 
?&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/section&gt;

</pre>
<p></code></p>
<p>In this example, we have <strong>displayed a Source directly on the page</strong>; however, we are talking about an RSS that currently only returns the List of News that contain the Title, the short Description and the Link to the Source page. Nowadays, however, <strong>almost all RSSs contain much more information</strong>; data that you can display and integrate, as in the previous example, in your PHP page if you want.</p>
<p>In this new example, we add other functions to our Code, to be able to import and <strong>display our RSS including the images</strong> of the Feed or, if it is not available, a default image.</p>
<p><code></p>
<pre>

&lt;?php
$rss = simplexml_load_file(&#039;https://blog.scriptnet.net/feed&#039;);
?&gt;
&lt;section id=&quot;recent-blog-posts&quot; class=&quot;recent-blog-posts&quot;&gt;
  &lt;div class=&quot;container&quot; data-aos=&quot;fade-up&quot;&gt;
    &lt;header class=&quot;section-header&quot;&gt;
      &lt;h2&gt;Blog&lt;/h2&gt;
      &lt;p&gt;Recent posts from our Blog&lt;/p&gt;
    &lt;/header&gt;
    &lt;div class=&quot;row&quot;&gt;
      &lt;?php foreach ($rss-&gt;channel-&gt;item as $item) { ?&gt;
        &lt;div class=&quot;col-lg-4&quot;&gt;
          &lt;div class=&quot;post-box&quot;&gt;
            &lt;?php

            // Gets the HTML content of the post's &quot;content&quot; element
            $content = $item-&gt;children(&#039;http://purl.org/rss/1.0/modules/content/&amp;#039;)-&gt;encoded;

            // Extracts the first &quot;img&quot; tag from the post content HTML
            preg_match(&#047;&lt;img.+src=[&#039;&quot;](?P&lt;src&gt;.+?)[&#039;&quot;].*&gt;&#047;i, $content, $image);

            // If an image is found, display it, otherwise display a default image
            if (!empty($image)) {
              echo &lt;div class=&quot;post-img&quot;&gt;&lt;img src=&quot;.&nbsp;$image[&#039;src&#039;]&quot; class=&quot;img-fluid&quot; alt=&quot;&quot;&gt;&lt;/div&gt;;
            } else {
              echo &lt;div class=&quot;post-img&quot;&gt;&lt;img src=&quot;https://via.placeholder.com/800x600.png?text=Image+not+available&quot; class=&quot;img-fluid&quot; alt=&quot;&quot;&gt;&lt;/div&gt;;
            }
            ?&gt;
            &lt;span class=&quot;post-date&quot;&gt;&lt;?php echo date(&#039;D, F j&#039;, strtotime($item-&gt;pubDate)); ?&gt;&lt;/span&gt;
            &lt;h3 class=&quot;post-title&quot;&gt;&lt;?php echo $item-&gt;title; ?&gt;&lt;/h3&gt;
            &lt;a href=&quot;&lt;?php echo $item-&gt;link; ?&gt;&quot; class=&quot;readmore stretched-link mt-auto&quot;&gt;&lt;span&gt;Read More&lt;/span&gt;&lt;i class=&quot;bi bi-arrow-right&quot;&gt;&lt;/i&gt;&lt;/a&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;?php } ?&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/section&gt;

</pre>
<p></code></p>
<p>In this example, we used the main style of the site, using the template classes and Bootstrap, which almost everyone uses nowadays. The news from the Feed are extracted and used to populate the Image, content, timestamp and link to the source fields. If there is no image, one of your choice is shown. Here an <strong><a href="https://scriptnet.net" rel="noopener" target="_blank">Live Example</a></strong> of the result:</p>
<p><img decoding="async" src="https://snap.new-web.net/uplo/cdn/CDN-1727197374-450.png" alt="Rss to Webpage" /></p>
<p>Good Coding!</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Create an efficient Banner Rotator in Json and PHP</title>
		<link>https://blog.scriptnet.net/create-an-efficient-banner-rotator-in-json-and-php/</link>
		
		<dc:creator><![CDATA[Team ScriptNet]]></dc:creator>
		<pubDate>Mon, 08 Jul 2024 16:01:06 +0000</pubDate>
				<category><![CDATA[Life as a Developer]]></category>
		<category><![CDATA[banner rotator]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[link rotator]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php code]]></category>
		<category><![CDATA[scriptnet]]></category>
		<guid isPermaLink="false">https://blog.scriptnet.net/?p=235</guid>

					<description><![CDATA[Over the years, every Developer has sooner or later faced this &#8220;dilemma&#8221;. Insert a Banner, Text or Link in a predefined position, randomly; the purpose is to show a different Image or Link each time a page loads. A common called &#8220;Banner Rotator&#8221; to be precise. Technically, there are many ways to create this system. [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><span id="more-235"></span></p>
<p>Over the years, every Developer has sooner or later faced this &#8220;dilemma&#8221;.<br />
<strong>Insert a Banner, Text or Link in a predefined position, randomly</strong>; the purpose is to show a different Image or Link each time a page loads. A common called &#8220;<strong>Banner Rotator</strong>&#8221; to be precise.</p>
<p>Technically, there are many ways to create this system.<br />
Today, we want to share a <strong>Simple and Effective system</strong>, to create this banner rotator, using 1 file in JSON, and few lines of PHP.<br />
<!--more--></p>
<p>The structure is very simple and accessible to everyone:</p>
<ul>
<li> The <strong><a href="https://www.json.org/json-en.html" rel="noopener" target="_blank">JSON</a></strong> file will contain the Data you want to show (images, texts and links)</li>
<li> The <strong><a href="https://www.php.net/" rel="noopener" target="_blank">PHP code</a></strong> will import the data on your page</li>
<li> The <strong><a href="https://www.w3schools.com/tags/tag_div.ASP" rel="noopener" target="_blank">DIV code</a></strong> will show the data on your page</li>
</ul>
<p>This system is solid, non-invasive, simple to compile and can be implemented on any PHP page in a few minutes.<br />
JSON is capable of containing even discrete quantities of data without any particular problems, so you can add new fields and expand the list of data to be displayed.<br />
Let&#8217;s start with the structure of the .json file which we will call &#8220;data.json&#8221;, but you can renamed as your needs.</p>
<p><code></p>
<pre>
{
  "banners": [
    {
      "text": "Your Text 1",
      "image": "image1.jpg",
      "link": "https://website1.com"
    },
    {
      "text": "Your Text 2",
      "image": "image2.jpg",
      "link": "https://website2.com"
    },
    {
      "text": "Your Text 3",
      "image": "image3.jpg",
      "link": "https://website3.com"
    }
  ]
}
</pre>
<p></code></p>
<p>Once you have compiled this file with your data with your favorite text editor, save and upload it to your web space in the position most suited to the project. Afterwards, we just need to <strong>insert a small PHP Code</strong>, which reads the data present in the Json file we just created. You can insert this code on the page where you want to display the banners, at the beginning of the code or the </head> tag.</p>
<p><code></p>
<pre>
&lt;?php
// Read the contents of the JSON file
$jsonData = file_get_contents('data.json');
$data = json_decode($jsonData, true);

// Get a random banner
$banners = $data['banners'];
$randomBanner = $banners[array_rand($banners)];
?&gt;
</pre>
<p></code></p>
<p>Now, let&#8217;s <strong>create a div</strong>, which you can insert into the page, in the position you want; remember that if you use images of a certain weight and size you may need to add CSS to make the images compatible with mobile devices.</p>
<p><code></p>
<pre>
<div id="banner">
    &lt;a href="&lt;?php echo $randomBanner['link']; ?&gt;" rel="noopener" target="_blank" title="">
        &lt;p&gt;&lt;?php echo $randomBanner['text']; ?&gt;&lt;/p&gt;&lt;br&gt;
        &lt;img src="&lt;?php echo $randomBanner['image']; ?&gt;" alt=""&gt;
    &lt;/a&gt;
</div>
</pre>
<p></code></p>
<p>In the code, the div indicates the position; the php code displays the data of the fields present in the .json file.<br />
Easy and Fast.</p>
<p>Life as a Developer can sometimes be simpler!</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
