<?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>Luongo Vincenzo - Blog &#187; PHP</title>
	<atom:link href="http://history.luongovincenzo.it/websites/my_website/v6/blog/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>https://history.luongovincenzo.it/websites/my_website/v6/blog</link>
	<description>    CiÃ² che non conoscete vi potrebbe danneggiare - Kevin Mitnick</description>
	<lastBuildDate>Mon, 09 Dec 2013 11:04:30 +0000</lastBuildDate>
	<language>it-IT</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.7.1</generator>
	<item>
		<title>[PHP/cURL] How to check file exists with PHP and cURL lib</title>
		<link>https://history.luongovincenzo.it/websites/my_website/v6/blog/phpcurl-how-to-check-file-exists-with-php-and-curl-lib/</link>
		<comments>https://history.luongovincenzo.it/websites/my_website/v6/blog/phpcurl-how-to-check-file-exists-with-php-and-curl-lib/#comments</comments>
		<pubDate>Mon, 09 Dec 2013 11:04:30 +0000</pubDate>
		<dc:creator><![CDATA[Vincenzo]]></dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.luongovincenzo.it/blog/?p=136</guid>
		<description><![CDATA[Salve a tutti, oggi vorrei condividere una semplice funziona per il controllo dell&#8217;esistenza di un file (foto, video, file in generale) con una semplice funzione php: function check_file_exists&#40;$file_url&#41; &#123; $ch = curl_init&#40;$file_url&#41;; curl_setopt&#40;$ch, CURLOPT_NOBODY, true&#41;; curl_exec&#40;$ch&#41;; $retcode = curl_getinfo&#40;$ch, CURLINFO_HTTP_CODE&#41;; curl_close&#40;$ch&#41;; &#160; if&#40;$retcode == '200'&#41; return TRUE; //exists else return FALSE;// not exists &#160; &#125; [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Salve a tutti,</p>
<p>oggi vorrei condividere una semplice funziona per il controllo dell&#8217;esistenza di un file (foto, video, file in generale)<br />
con una semplice funzione php:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> check_file_exists<span style="color: #009900;">&#40;</span><span style="color: #000088;">$file_url</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file_url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_NOBODY<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$retcode</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_getinfo</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLINFO_HTTP_CODE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">curl_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$retcode</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'200'</span><span style="color: #009900;">&#41;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//exists</span>
	<span style="color: #b1b100;">else</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">// not exists</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Questa funzione cerca di ritornare l&#8217;HTTP CODE dal server remoto per restituirne il codice,<br />
nel nostro caso se il codice di ritorno Ã¨ 200 allora il file esiste, altrimenti no.</p>
<p>Esempio di utilizzo potrebbe essere:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$file_remoto</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://www.tuolink.com/multimedia.png'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>check_file_exists<span style="color: #009900;">&#40;</span><span style="color: #000088;">$file_remoto</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">print</span> <span style="color: #0000ff;">'File esistente!'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">print</span> <span style="color: #0000ff;">'File NON esistente!'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Questo Ã¨ tutto, spero servirÃ  a qualcuno <img src='http://history.luongovincenzo.it/websites/my_website/v6/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>https://history.luongovincenzo.it/websites/my_website/v6/blog/phpcurl-how-to-check-file-exists-with-php-and-curl-lib/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[PHP/Socket] How to send  data via POST with the Socket</title>
		<link>https://history.luongovincenzo.it/websites/my_website/v6/blog/phpsocket-how-to-send-data-via-post-with-the-socket/</link>
		<comments>https://history.luongovincenzo.it/websites/my_website/v6/blog/phpsocket-how-to-send-data-via-post-with-the-socket/#comments</comments>
		<pubDate>Mon, 04 Nov 2013 10:39:32 +0000</pubDate>
		<dc:creator><![CDATA[Vincenzo]]></dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.luongovincenzo.it/blog/?p=126</guid>
		<description><![CDATA[Holaz a todos, come per l&#8217;articolo precedente dell&#8217;invio di dati via POST con le cURL, ora vi spiego come inviarli via socket in PHP. Questo script potrebbe essere utile qualora vi venisse in mente di effettuare uno scambio dati su svariati web server. Ecco il codice (sempre rigorosamente commentato): &#60;?php //Nome della pagina alla quale [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Holaz a todos,</p>
<p>come per <a href="http://www.luongovincenzo.it/blog/php-how-to-send_data_using_post_method_to_any_page_with_curl/" title="[PHP/cURL] How to send data using POST method to any page with cURL" target="_blank">l&#8217;articolo precedente</a> dell&#8217;invio di dati via POST con le cURL, ora vi spiego come inviarli via <a href="http://php.net/manual/it/book.sockets.php" title="PHP: Sockets - Manual" target="_blank">socket</a> in PHP.<br />
Questo script potrebbe essere utile qualora vi venisse in mente di effettuare uno scambio dati su svariati web server.</p>
<p>Ecco il codice (sempre rigorosamente commentato):</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">//Nome della pagina alla quale inviare i dati</span>
<span style="color: #000088;">$uri</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'/test/response_socket.php'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Indirizzo web (http:// o IP) dove indirizzare la chiamata socket (in questo caso Ã¨ su un web server in locale)</span>
<span style="color: #000088;">$sito</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'192.168.1.1'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'username=luongovincenzo92&amp;password=7c4a8d09ca3762af61e59520943dc26494f8941b'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//valori post</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Controllo se la chiamate via socket va a buon fine sulla porta 80</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sock</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fsockopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sito</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">8080</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">// se va bene creo l'oggetto $sock</span>
	<span style="color: #990000;">die</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;[ERRPR] Connessione non riuscita, si prega di controllare se le socket sono abilitate&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Genero il il pacchetto POST (HEADER HTTP) per inviarlo</span>
<span style="color: #990000;">fputs</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$sock</span><span style="color: #339933;">,</span>
  <span style="color: #0000ff;">&quot;POST <span style="color: #006699; font-weight: bold;">$uri</span> HTTP/1.1<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span>
  <span style="color: #0000ff;">&quot;Host: <span style="color: #006699; font-weight: bold;">$sito</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span>
  <span style="color: #0000ff;">&quot;Content-Type: application/x-www-form-urlencoded<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span>
  <span style="color: #0000ff;">&quot;Content-Length: &quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span> <span style="color: #666666; font-style: italic;">//Grandezza della chiamata</span>
  <span style="color: #0000ff;">&quot;Connection: close<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span>
  <span style="color: #000088;">$query</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//dati di invio</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Vabiabile di contenimento dell'output di risposta</span>
<span style="color: #000088;">$out</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Ciclo e attendo la risposta del socket per estrapolare la risposta del file</span>
<span style="color: #666666; font-style: italic;">// fino a termine della chiamata</span>
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">feof</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sock</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #000088;">$out</span> <span style="color: #339933;">.=</span> <span style="color: #990000;">fgets</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sock</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Chiudo la connessione</span>
<span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sock</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">//Cerco di pulire l'output sporcato dalla richiesta ( prima dei doppi \r\n cÃ¨ la richiesta HTTP completa che a noi non serve)</span>
<span style="color: #000088;">$output_pulito</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$out</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Stampo la risposta</span>
<span style="color: #b1b100;">print</span> <span style="color: #000088;">$output_pulito</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Per la pagina di risposta c&#8217;Ã¨ sempre la solita:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Note: Ricordate che per eseguire correttamente questo script dovreste avere abilitate le socket sul vostro web server altrimenti non funzionerÃ  mai.</p>
<p>Note 2: Se invece dovete aprire una connessione ad un web server esterno, dovrete abilitate il parametro <strong>allow_url_fopen</strong> del vostro <strong>php.ini</strong></p>
<p>Ogni problema o dubbio commentate <img src='http://history.luongovincenzo.it/websites/my_website/v6/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>https://history.luongovincenzo.it/websites/my_website/v6/blog/phpsocket-how-to-send-data-via-post-with-the-socket/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[PHP/cURL] How to send data using POST method to any page with cURL</title>
		<link>https://history.luongovincenzo.it/websites/my_website/v6/blog/php-how-to-send_data_using_post_method_to_any_page_with_curl/</link>
		<comments>https://history.luongovincenzo.it/websites/my_website/v6/blog/php-how-to-send_data_using_post_method_to_any_page_with_curl/#comments</comments>
		<pubDate>Mon, 04 Nov 2013 10:11:58 +0000</pubDate>
		<dc:creator><![CDATA[Vincenzo]]></dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.luongovincenzo.it/blog/?p=121</guid>
		<description><![CDATA[Salve a tutti, da un recente progetto, mi sono tornate utili le librerie PHP di cURL per potermi dare la possibilitÃ  di inviare delle richieste con metodo POST ad un determinato Web Server. vediamo di seguito come utilizzarle: &#60;?php &#160; //Qui dichiariamo la pagina con url completo, alla quale inviare i dati $url = &#34;http://www.sito.com/pagina_richiede_dati.php&#34;; [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Salve a tutti,</p>
<p>da un recente progetto, mi sono tornate utili le librerie <a href="http://php.net/" title="php.net" target="_blank">PHP</a> di <a href="http://curl.haxx.se/libcurl/php/" title="cURL - PHP" target="_blank">cURL</a> per potermi dare la possibilitÃ  di inviare delle richieste con metodo POST ad un determinato Web Server.<br />
vediamo di seguito come utilizzarle:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">//Qui dichiariamo la pagina con url completo, alla quale inviare i dati</span>
<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://www.sito.com/pagina_richiede_dati.php&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Qui ninvece, dichiariamo i dati da inviare come se fossero via GET (quindi separati da una &amp; )</span>
<span style="color: #000088;">$send_data</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;username=luongovincenzo92&amp;password=7c4a8d09ca3762af61e59520943dc26494f8941b&amp;token=e10adc3949ba59abbe56e057f20f883e&quot;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">//Qui iniziamo ad utilizzare la libreria inizializzandola</span>
<span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
&nbsp;
<span style="color: #666666; font-style: italic;">//Qui settiamo l'utl sulla quale inviare i dati</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
&nbsp;
<span style="color: #666666; font-style: italic;">//Qui settiamo la metodologia di invio dati (in questo caso POST)</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_POST<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
&nbsp;
<span style="color: #666666; font-style: italic;">//Qui specifichiamo quali dati inviare alla pagina</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_POSTFIELDS<span style="color: #339933;">,</span> <span style="color: #000088;">$send_data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
&nbsp;
<span style="color: #666666; font-style: italic;">//Qui settiamo che vogliamo un valore di ritorno (in questo caso tutto ciÃ² che restituisce la pagina)</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">//Eseguo il comando e mi conservo la risposta della pagina</span>
<span style="color: #000088;">$response</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">//Chiudo la connessione</span>
<span style="color: #990000;">curl_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">// $res contiene la risposta della pagina a cui abbiamo inviato i dati via POST</span>
<span style="color: #b1b100;">print</span> <span style="color: #000088;">$response</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>La pagina alla quale abbiamo inviato i dati Ã¨ un qualcosa di simile:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
&nbsp;
<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>E dalla pagina di invio dovremmo avere una risposta simile:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">Array(
	&quot;username&quot; =&gt; &quot;luongovincenzo92&quot;,
	&quot;password&quot; =&gt; &quot;7c4a8d09ca3762af61e59520943dc26494f8941b&quot;,
	&quot;token&quot;    =&gt; &quot;e10adc3949ba59abbe56e057f20f883e&quot;
);</pre></td></tr></table></div>

<p>Ed ecco tutto.</p>
<p>Alla prossima ^_^</p>
]]></content:encoded>
			<wfw:commentRss>https://history.luongovincenzo.it/websites/my_website/v6/blog/php-how-to-send_data_using_post_method_to_any_page_with_curl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[PHP] How to create a ZIP file and download</title>
		<link>https://history.luongovincenzo.it/websites/my_website/v6/blog/php_how_to_create_a_zip_file_and_download/</link>
		<comments>https://history.luongovincenzo.it/websites/my_website/v6/blog/php_how_to_create_a_zip_file_and_download/#comments</comments>
		<pubDate>Mon, 04 Nov 2013 09:54:39 +0000</pubDate>
		<dc:creator><![CDATA[Vincenzo]]></dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.luongovincenzo.it/blog/?p=118</guid>
		<description><![CDATA[Salve a tutti, recentemente mi Ã¨ tornato utile creare un archivio zip di determinati file, per poi poterlo scaricare dal web al volo. Per fare ciÃ² mi sono servito della fantastica libreria PclZip con la quale effettuare questa operazione. bene ora vediamo il codice rigorosamente commentato &#60;?php &#160; //CONFIG: Definisco uan variabile costante per dichiarare [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Salve a tutti,</p>
<p>recentemente mi Ã¨ tornato utile creare un archivio zip di determinati file, per poi poterlo scaricare dal web al volo.<br />
Per fare ciÃ² mi sono servito della fantastica libreria <a href="http://www.phpconcept.net/pclzip/pclzip-downloads" title="PclZip" target="_blank">PclZip</a> con la quale effettuare questa operazione.<br />
bene ora vediamo il codice rigorosamente commentato</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//CONFIG: Definisco uan variabile costante per dichiarare</span>
<span style="color: #666666; font-style: italic;">// la cartella dove Ã¨ contenuta la libreria PclZip</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'__PATH_ZIP_LIB__'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'./pclzip-2-6/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//Change this</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Nome dell'archivio </span>
<span style="color: #000088;">$nome_archivio_zip</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Archivio_&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;dmY&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;_&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.zip&quot;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">//CONTROL: se esiste giÃ , cerco di cancellarlo</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$nome_archivio_zip</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> 
	<span style="color: #339933;">@</span><span style="color: #990000;">unlink</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$nome_archivio_zip</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">//Includo la libreria e genero l'oggetto zip </span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span>__PATH_ZIP_LIB__<span style="color: #339933;">.</span><span style="color: #0000ff;">'pclzip.lib.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #000088;">$pclzip_obj</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> PclZip<span style="color: #009900;">&#40;</span><span style="color: #000088;">$nome_archivio_zip</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">//Una lista di nomi di files da comprimere </span>
<span style="color: #000088;">$lista_file_da_zippare</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;profile.php,users.php,mysql.class.php&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//potete scrivere anche il nome di un singolo file eliminando la virgola finale</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Aggiungo i files all'archivio </span>
<span style="color: #000088;">$response_pclzip</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$pclzip_obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$lista_file_da_zippare</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">//Controllo eventuali errori che possibilmente </span>
<span style="color: #666666; font-style: italic;">//ha scaturito la compressione</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$response_pclzip</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
    <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;[ERROR] PclZip : &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$pclzip_obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">errorInfo</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">//Opzionale: scarico l'archivio ZIP</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'download'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>	
&nbsp;
	<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-type: application/zip&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Disposition: attachment; filename=<span style="color: #006699; font-weight: bold;">$nome_archivio_zip</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Description: Backup&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Length: &quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">filesize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$nome_archivio_zip</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	<span style="color: #990000;">readfile</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$nome_archivio_zip</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Ecco il sorgente giÃ  funzionante, potete modificarlo a vostro piacimento per le vostre esigenze.<br />
Se volete far scaricare direttamente il file bastera richiamare il file php con il seguente URL:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">nome_file.php?download=1</pre></td></tr></table></div>

<p>Fine, spero servirÃ  a qualcuno <img src='http://history.luongovincenzo.it/websites/my_website/v6/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>https://history.luongovincenzo.it/websites/my_website/v6/blog/php_how_to_create_a_zip_file_and_download/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Javascript/PHP] How to delete the last character from a string</title>
		<link>https://history.luongovincenzo.it/websites/my_website/v6/blog/javascriptphp-how-to-delete-the-last-character-from-a-string/</link>
		<comments>https://history.luongovincenzo.it/websites/my_website/v6/blog/javascriptphp-how-to-delete-the-last-character-from-a-string/#comments</comments>
		<pubDate>Wed, 09 Oct 2013 09:18:59 +0000</pubDate>
		<dc:creator><![CDATA[Vincenzo]]></dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.luongovincenzo.it/blog/?p=87</guid>
		<description><![CDATA[Salve a tutti, oggi scriverÃ² questo breve articolo per spiegare come eliminare l&#8217;ultimo carattere da una stringa, sia in linguaggio javascript che in PHP. Per far ciÃ² ci basta conoscere 2 funzioni dei relativi linguaggi, ovvero: substr (sia in javascript che in PHP) e strlen (in PHP) e l&#8217;equivalente in javascript ovvero .length . Bene [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Salve a tutti,</p>
<p>oggi scriverÃ² questo breve articolo per spiegare come eliminare l&#8217;ultimo carattere da una stringa, sia in linguaggio javascript che in PHP.</p>
<p>Per far ciÃ² ci basta conoscere 2 funzioni dei relativi linguaggi, ovvero: substr (sia in javascript che in PHP) e strlen (in PHP) e l&#8217;equivalente in javascript ovvero .length .</p>
<p>Bene ora passiamo alle due funzioni:</p>
<p>Javascript:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">function</span> delete_last_character<span style="color: #009900;">&#40;</span>str<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">var</span> charts_num <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Questa variabil Ã¨ possibile manipolarla a seconda di quanti caratteri ULTIMI eliminare</span>
    <span style="color: #000066; font-weight: bold;">var</span> len <span style="color: #339933;">=</span> str.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>
    str <span style="color: #339933;">=</span> str.<span style="color: #660066;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> len <span style="color: #339933;">-</span> charts_num<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">return</span> str<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>PHP:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> delete_last_character<span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$charts_num</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Questa variabil Ã¨ possibile manipolarla a seconda di quanti caratteri ULTIMI eliminare</span>
    <span style="color: #b1b100;">return</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$charts_num</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Questo Ã¨ tutto, utilizzando queste funzioni vi ritornerÃ  la stringa senza l&#8217;ultimo carattere finale o, modificando la variabile charts_num, vi permetterÃ  di eliminare tot caratteri asseconda del set di questa variabile.</p>
<p>Detto questo, un saluto a tutti e alla prossima.</p>
]]></content:encoded>
			<wfw:commentRss>https://history.luongovincenzo.it/websites/my_website/v6/blog/javascriptphp-how-to-delete-the-last-character-from-a-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[PHP] How to remove null values â€‹â€‹from an array</title>
		<link>https://history.luongovincenzo.it/websites/my_website/v6/blog/php-rimuovere-i-valori-null-da-un-array/</link>
		<comments>https://history.luongovincenzo.it/websites/my_website/v6/blog/php-rimuovere-i-valori-null-da-un-array/#comments</comments>
		<pubDate>Wed, 04 Sep 2013 12:41:52 +0000</pubDate>
		<dc:creator><![CDATA[Vincenzo]]></dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.luongovincenzo.it/blog/?p=71</guid>
		<description><![CDATA[Salve a tutti, Ã¨ da un pÃ² di tempo che nons crivevo qualcosa, e oggi vi propongo una soluzione per eliminare i valori NULL da un&#8217;array PHP. Ecco la funzione function array_remove_null&#40;&#38;$array, $maintian_keys = true&#41;&#123; $new_array = array&#40;&#41;; if&#40;is_array&#40;$array&#41;&#41;&#123; foreach&#40;$array as $k=&#62;$v&#41;&#123; if&#40;$v&#38;&#38;$maintian_keys&#41; $new_array&#91;$k&#93;=$v; elseif&#40;$v&#41; $new_array&#91;&#93;=$v; &#125; &#125; $array = $new_array; return $array; &#125; Per [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Salve a tutti,</p>
<p>Ã¨ da un pÃ² di tempo che nons crivevo qualcosa, e oggi vi propongo una soluzione per eliminare i valori NULL da un&#8217;array PHP.</p>
<p>Ecco la funzione</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> array_remove_null<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$array</span><span style="color: #339933;">,</span> <span style="color: #000088;">$maintian_keys</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$new_array</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$array</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$array</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$k</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$v</span><span style="color: #339933;">&amp;&amp;</span><span style="color: #000088;">$maintian_keys</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$new_array</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$k</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #000088;">$v</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$new_array</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #000088;">$v</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000088;">$array</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$new_array</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$array</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Per utilizzarla</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;">array_remove_null<span style="color: #009900;">&#40;</span><span style="color: #000088;">$your_array_object</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>La funzione Ã¨ utilissima per la pulizzia di un&#8217;array parsato tante volte.</p>
<p><a href="http://www.sastgroup.com/tutorials/php-rimuovere-i-valori-null-da-un-array">FONTE</a></p>
]]></content:encoded>
			<wfw:commentRss>https://history.luongovincenzo.it/websites/my_website/v6/blog/php-rimuovere-i-valori-null-da-un-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[PHP] How to get file extension</title>
		<link>https://history.luongovincenzo.it/websites/my_website/v6/blog/31/</link>
		<comments>https://history.luongovincenzo.it/websites/my_website/v6/blog/31/#comments</comments>
		<pubDate>Wed, 05 Jun 2013 20:13:10 +0000</pubDate>
		<dc:creator><![CDATA[Vincenzo]]></dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.luongovincenzo.it/blog/?p=31</guid>
		<description><![CDATA[Holaz a todos piccolo promemoria per estrarre dal nome di un file, la sua estenzione. Ho optato per un semplice scriptino in PHP che mi Ã¨ tornato molto utile: &#60;?php &#160; &#160; function getExt&#40;$fName&#41; &#123; $ext = explode&#40; &#34;.&#34;, $fName &#41;; return strtoupper&#40; $ext&#91; count&#40; $ext &#41; - 1 &#93; &#41;; &#125; &#160; $file = [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Holaz a todos <img src='http://history.luongovincenzo.it/websites/my_website/v6/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>piccolo promemoria per estrarre dal nome di un file, la sua estenzione.</p>
<p>Ho optato per un semplice scriptino in PHP che mi Ã¨ tornato molto utile:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> getExt<span style="color: #009900;">&#40;</span><span style="color: #000088;">$fName</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$ext</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;.&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fName</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #990000;">strtoupper</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$ext</span><span style="color: #009900;">&#91;</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$ext</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;pagina.class.php&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">print</span> getExt<span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Basta richiamarsi tale funzione getExt() e vi ritornerÃ  indietro l&#8217;estenzione del file controllato.</p>
<p>Enjoy</p>
]]></content:encoded>
			<wfw:commentRss>https://history.luongovincenzo.it/websites/my_website/v6/blog/31/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[PHP] How to view the latest articles wordpress</title>
		<link>https://history.luongovincenzo.it/websites/my_website/v6/blog/php-visualizzare-gli-ultimi-articoli-wordpress/</link>
		<comments>https://history.luongovincenzo.it/websites/my_website/v6/blog/php-visualizzare-gli-ultimi-articoli-wordpress/#comments</comments>
		<pubDate>Wed, 05 Jun 2013 19:58:18 +0000</pubDate>
		<dc:creator><![CDATA[Vincenzo]]></dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.luongovincenzo.it/blog/?p=28</guid>
		<description><![CDATA[Salve a tutti, oggi ho implementato nella home page del sito, la visualizzazione degli ultimi 7 articoli del blog. Lo script PH che ho utilizzato Ã¨ molto semplice ma molto utile e facile da implementare in qualsiasi sito nella quale Ã¨ installato il CMS wordpress. Lo script PHP in questione Ã¨ il sequente: &#60;?php define&#40;'__BLOG_DIR__', [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Salve a tutti,</p>
<p>oggi ho implementato nella home page del sito, la visualizzazione degli ultimi 7 articoli del blog.<br />
Lo script PH che ho utilizzato Ã¨ molto semplice ma molto utile e facile da implementare in qualsiasi sito nella quale Ã¨ installato il CMS wordpress.</p>
<p>Lo script PHP in questione Ã¨ il sequente:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'__BLOG_DIR__'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'blog/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//Settare la directory del vostro sito dove si trova il cms</span>
&nbsp;
<span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span>__BLOG_DIR__<span style="color: #339933;">.</span><span style="color: #0000ff;">'wp-blog-header.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&lt;ul&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$count</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$post</span>  <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span> 
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$count</span> <span style="color: #339933;">&lt;&gt;</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">//al posto del numero 5 potrete mettere il numero che vorrete degli articoli che vorrete var visualizzare</span>
	<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&lt;li&gt;&lt;a href=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">print</span> the_permalink<span style="color: #009900;">&#40;</span>the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">print</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;&lt;/a&gt;&lt;/li&gt;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$count</span><span style="color: #339933;">++;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&lt;/ul&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Spero che questo script possa servire a qualcuno.</p>
<p>Saluti <img src='http://history.luongovincenzo.it/websites/my_website/v6/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>https://history.luongovincenzo.it/websites/my_website/v6/blog/php-visualizzare-gli-ultimi-articoli-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
