<?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>dev/null &#187; jQuery</title>
	<atom:link href="http://devnull.fuoriradio.com/tag/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://devnull.fuoriradio.com</link>
	<description>appunti interessanti e non di un programmatore</description>
	<lastBuildDate>Tue, 19 Apr 2011 15:22:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>jPlayer un plugin jquery per l&#8217;audio html5 (e flash se html5 non c&#8217;è)</title>
		<link>http://devnull.fuoriradio.com/2010/02/01/jplayer-un-plugin-jquery-per-laudio-html5-e-flash-se-html5-non-ce/</link>
		<comments>http://devnull.fuoriradio.com/2010/02/01/jplayer-un-plugin-jquery-per-laudio-html5-e-flash-se-html5-non-ce/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 15:21:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[mp3]]></category>
		<category><![CDATA[ogg]]></category>

		<guid isPermaLink="false">http://devnull.fuoriradio.com/?p=149</guid>
		<description><![CDATA[jPlayer è un plug-in per jQuery che consente di: suonare ed avere pieno controllo dei file audio nella tua pagina web. creare e disegnare un player audio soltanto con HTML e CSS aggiungere effeti sonori ai tuoi progetti jQuery utilizzare le caratteristiche di streaming veloci di HTML5in mp3 e ogg. Tutto questo è ottenuto con [...]]]></description>
			<content:encoded><![CDATA[<p><img style="float:left; margin: 8px" src="http://snapcasa.com/get.aspx?code=9019&size=l&url=http%3A%2F%2Fwww.happyworm.com%2Fjquery%2Fjplayer%2F"/ ></p>
<p><a href="http://www.happyworm.com/jquery/jplayer/">jPlayer</a> è un plug-in per <a href="http://jquery.com">jQuery</a> che consente di:</p>
<ul>
<li> suonare ed avere pieno controllo dei file audio nella tua pagina web.</li>
<li>creare e disegnare un player audio soltanto con  HTML e CSS</li>
<li>aggiungere effeti sonori ai tuoi progetti jQuery</li>
<li>utilizzare le caratteristiche di streaming veloci di HTML5in mp3 e <a href="http://devnull.fuoriradio.com/2010/01/30/convertire-mp3-in-ogg-vorbis/">ogg</a>.</li>
</ul>
<p>Tutto questo è ottenuto con HTML5 in mp3 e ogg dove disponibile, e in mp3 con un player Flash invisibile per gli altri browser.</p>
<p class='fb-like'><iframe src='http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fdevnull.fuoriradio.com%2F2010%2F02%2F01%2Fjplayer-un-plugin-jquery-per-laudio-html5-e-flash-se-html5-non-ce%2F&amp;layout=button_count&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=65&amp;font=lucida+grande' scrolling='no' frameborder='0' allowTransparency='true' style='border:none; overflow:hidden; width:450px; height:65px'></iframe></p>]]></content:encoded>
			<wfw:commentRss>http://devnull.fuoriradio.com/2010/02/01/jplayer-un-plugin-jquery-per-laudio-html5-e-flash-se-html5-non-ce/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dialogare con un server REST remoto in xml con php e JQuery.</title>
		<link>http://devnull.fuoriradio.com/2010/01/22/dialogare-con-un-server-rest-remoto-in-xml-con-php-e-jquery/</link>
		<comments>http://devnull.fuoriradio.com/2010/01/22/dialogare-con-un-server-rest-remoto-in-xml-con-php-e-jquery/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 12:42:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jParse]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://devnull.fuoriradio.com/?p=14</guid>
		<description><![CDATA[Uno dei problemi più comuni che si presentano ai programmatori del web 2.0 è dialogare con un server REST in xml o in JSON a seconda dei casi. La prima cosa da fare è creare uno script PHP che si occupi di fare da Proxi tra il server REST e quello che contiene la nostra [...]]]></description>
			<content:encoded><![CDATA[<p>Uno dei problemi più comuni che si presentano ai programmatori del web 2.0 è dialogare con un server REST in xml o in JSON a seconda dei casi.</p>
<p><img style="float:left; margin: 8px" src="http://snapcasa.com/get.aspx?code=9019&size=l&url=www.jquery.com"/ ></p>
<p>La prima cosa da fare è creare uno script PHP che si occupi di fare da Proxi tra il server REST e quello che contiene la nostra applicazione, infatti la richiesta XmlHttpRequest di Javascript è per motivi di sicurezza legata esclusivamente al domino su cui viene effettuata.</p>
<p>Scriviamo quindi per prima cosa la parte PHP che ci è necessaria, utilizzando CURL è semplicissimo:</p>
<p><span id="more-14"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><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;">// Per sicurezza è meglio che l'hostname del server rest non sia un parametro</span>
<span style="color: #666666; font-style: italic;">// ma sia scritto staticamente.</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'HOSTNAME'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'http://www.wheretherestserveris.com/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Prende il path del file rest</span>
<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'query'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> HOSTNAME<span style="color: #339933;">.</span><span style="color: #000088;">$query</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Apre Curl</span>
<span style="color: #000088;">$mycurl</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Setto curl per restituire solo il contenuto senza header</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mycurl</span><span style="color: #339933;">,</span> CURLOPT_HEADER<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</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;">$mycurl</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<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: #000088;">$myxml</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mycurl</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Imposto gli header XML</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Type: text/xml&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$myxml</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mycurl</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Salviamo il nostro file proxi sul nostro dominio con il nome desiderato (Es. myrestserver.php) , e poi utilizziamo <a href="http://jquery.com/">jQuery</a> e il plugin <a href="http://jparse.kylerush.net/">jParse</a> per interpretare comodamente l&#8217;xml, ecco uno snippet di esempio del codice javascript necessario:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#divchevoglio'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">jParse</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
ajaxOpts<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>url<span style="color: #339933;">:</span> <span style="color: #3366CC;">'myrestserver.php?query=iwantthis.xml'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
elementTag<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'field1'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'field2'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'field3'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
output<span style="color: #339933;">:</span> <span style="color: #3366CC;">' &lt;div&gt;&lt;ul&gt;&lt;li&gt;jpet0&lt;/li&gt;&lt;li&gt;jpet1&lt;/li&gt;&lt;li&gt;jpet2&lt;/li&gt;&lt;/div&gt;'</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Per approfondimenti su opzioni, callback etc. guardate il sito ufficiale di <a href="http://jparse.kylerush.net/">jParse</a></p>
<p>Spero di essere stato utile.</p>
<p><div style="text-align: center"><script type="text/javascript"><!--
google_ad_client = "pub-9763589373223061";
/* 468x60, devnull */
google_ad_slot = "9717154544";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></p>
<p class='fb-like'><iframe src='http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fdevnull.fuoriradio.com%2F2010%2F01%2F22%2Fdialogare-con-un-server-rest-remoto-in-xml-con-php-e-jquery%2F&amp;layout=button_count&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=65&amp;font=lucida+grande' scrolling='no' frameborder='0' allowTransparency='true' style='border:none; overflow:hidden; width:450px; height:65px'></iframe></p>]]></content:encoded>
			<wfw:commentRss>http://devnull.fuoriradio.com/2010/01/22/dialogare-con-un-server-rest-remoto-in-xml-con-php-e-jquery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

