tag:blogger.com,1999:blog-67589190372717095912024-02-19T22:40:13.777-08:00Tirupati Balan Web StuffGet daily updates & programming tips related with html, javascript, css and phpUnknownnoreply@blogger.comBlogger9125tag:blogger.com,1999:blog-6758919037271709591.post-69164670983234318612011-11-01T00:10:00.000-07:002011-11-01T00:10:30.507-07:00Get Address using latitude and longitude - Google Reverse GeoCode<div dir="ltr" style="text-align: left;" trbidi="on"><br />
<span class="Apple-style-span" style="background-color: white;"><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"><</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;">span id</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'addressObj'</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">></span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"></</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">span</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">></span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"><</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">script type</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'text/javascript'</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">></span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw2" style="font-family: 'Courier New', Courier, monospace; font-size: 13px; font-weight: bold; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">var</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> geocoder </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw2" style="font-family: 'Courier New', Courier, monospace; font-size: 13px; font-weight: bold; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">new</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> google</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">maps</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">Geocoder</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw2" style="font-family: 'Courier New', Courier, monospace; font-size: 13px; font-weight: bold; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">var</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> myLatlng </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw2" style="font-family: 'Courier New', Courier, monospace; font-size: 13px; font-weight: bold; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">new</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> google</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">maps</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">LatLng</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">00.0000</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">,</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">00.0000</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">; // put proper lat lon value</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw2" style="font-family: 'Courier New', Courier, monospace; font-size: 13px; font-weight: bold; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">var</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> address</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> geocoder</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">geocode</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">{</span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'latLng'</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">:</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> myLatlng</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">}</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">,</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw2" style="font-family: 'Courier New', Courier, monospace; font-size: 13px; font-weight: bold; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">function</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">results</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">,</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> status</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">{</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="co1" style="color: #666666; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">// getting address from latLong i.e latitude and longitude</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"></span><span class="kw1" style="color: #b1b100; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> if</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">status </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">==</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> google</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">maps</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">GeocoderStatus</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">OK</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">{</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="co1" style="color: #666666; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">// If status is OK means address is found by server</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw1" style="color: #b1b100; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">if</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">results</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">[</span><span class="nu0" style="color: #cc66cc; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">1</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">]</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">{</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> address </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> results</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">[</span><span class="nu0" style="color: #cc66cc; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">1</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">]</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">formatted_address</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> document</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">getElementById</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'addressObj'</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">innerHTML </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> address</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">}</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw1" style="color: #b1b100; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">else</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">{</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> document</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">getElementById</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'addressObj'</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">innerHTML </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> status</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">}</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">}</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw1" style="color: #b1b100; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">else</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">{</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="co1" style="color: #666666; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">// Otherwise it return address empty or undefined thats why we display status and latLong only</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> document</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">getElementById</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'addressObj'</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">innerHTML </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> status</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">}</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">}</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span></span><br />
<span class="Apple-style-span" style="background-color: white;"><span class="kw2" style="font-family: 'Courier New', Courier, monospace; font-size: 13px; font-weight: bold; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"></script></span></span><br />
<br />
<div class="zemanta-pixie" style="height: 15px; margin-top: 10px;"><a class="zemanta-pixie-a" href="http://www.zemanta.com/" title="Enhanced by Zemanta"><img alt="Enhanced by Zemanta" class="zemanta-pixie-img" src="http://img.zemanta.com/zemified_e.png?x-id=875863c1-f2a2-4b03-85ff-80725a42c72d" style="border: none; float: right;" /></a></div></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6758919037271709591.post-88080384641774986302011-10-31T07:56:00.001-07:002011-10-31T07:59:27.211-07:00Upload image to facebook album using fb PHP SDK<div dir="ltr" style="text-align: left;" trbidi="on"><span class="Apple-style-span" style="background-color: white;"><span class="kw2" style="font-family: 'Courier New', Courier, monospace; font-size: 13px; font-weight: bold; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">function</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;"> uploadPhotos</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$imagePath</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">,</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$imageName</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">,</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$countdowntype</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">{</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> try </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">{</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="co1" style="color: #666666; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">//At the time of writing it is necessary to enable upload support in the Facebook SDK, you do this with the line:</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$facebook</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$_SESSION</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">[</span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'facebook'</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">]</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$facebook</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">-></span><span class="me1" style="color: #004000; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">setFileUploadSupport</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'http://localhost/WCSERVER/index.php'</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$response</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$facebook</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">-></span><span class="me1" style="color: #004000; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">api</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'/me/photos/'</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">,</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'post'</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">,</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><a href="http://www.php.net/array" style="color: #000066; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"><span class="kw3" style="color: #990000;">array</span></a><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'message'</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=></span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'4 years, 6 months, 11 days, 18 hours, 56 minutes, 3 seconds until our '</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$countdowntype</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">,</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'name'</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=></span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'Wedding Countdown Photos'</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">,</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'source'</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=></span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'@'</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$imagePath</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$imageName</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="co1" style="color: #666666; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">// @-sign must be the first character</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">}</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> catch </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">FacebookApiException </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$e</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">{</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><a href="http://www.php.net/error_log" style="color: #000066; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"><span class="kw3" style="color: #990000;">error_log</span></a><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'Could not post image to Facebook.'</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">}</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">}</span></span></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6758919037271709591.post-33707676602895579412011-10-31T07:53:00.001-07:002011-10-31T07:59:27.226-07:00Authenticate facebook application using facebook PHP SDK<div dir="ltr" style="text-align: left;" trbidi="on"> <br />
<div class="p1"><span class="Apple-style-span" style="background-color: white;"><span class="kw2" style="font-family: 'Courier New', Courier, monospace; font-size: 13px; font-weight: bold; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">function</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;"> validateFacebookUser</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">{</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="co1" style="color: #666666; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">// Create our Application instance (replace this with your appId and secret).</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$facebook</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw2" style="font-family: 'Courier New', Courier, monospace; font-size: 13px; font-weight: bold; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">new</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> Facebook</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><a href="http://www.php.net/array" style="color: #000066; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"><span class="kw3" style="color: #990000;">array</span></a><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'appId'</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=></span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'id here'</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">,</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'secret'</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=></span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'secret here'</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">,</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="co1" style="color: #666666; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">// Get User ID</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$user</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$facebook</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">-></span><span class="me1" style="color: #004000; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">getUser</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw1" style="color: #b1b100; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">if</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$user</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">{</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> try </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">{</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="co1" style="color: #666666; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">// Proceed knowing you have a logged in user who's authenticated.</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$user_profile</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$facebook</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">-></span><span class="me1" style="color: #004000; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">api</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'/me'</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">}</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> catch </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">FacebookApiException </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$e</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">{</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><a href="http://www.php.net/error_log" style="color: #000066; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"><span class="kw3" style="color: #990000;">error_log</span></a><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$e</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$user</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw4" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; font-weight: bold; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">null</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">}</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">}</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="co1" style="color: #666666; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">// Login or logout url will be needed depending on current user state.</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw1" style="color: #b1b100; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">if</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$user</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">{</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$logoutUrl</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$facebook</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">-></span><span class="me1" style="color: #004000; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">getLogoutUrl</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">}</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw1" style="color: #b1b100; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">else</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">{</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$loginUrl</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$facebook</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">-></span><span class="me1" style="color: #004000; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">getLoginUrl</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw1" style="color: #b1b100; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">echo</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="st0" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">"<script> top.location.href='"</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$loginUrl</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st0" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">"'</script>"</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">}</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">}</span></span></div></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6758919037271709591.post-62654130972278973472011-10-31T07:51:00.001-07:002011-10-31T07:59:27.257-07:00Upload image to facebook album without facebook sdk using php<div dir="ltr" style="text-align: left;" trbidi="on"><span class="Apple-style-span" style="background-color: white;"><span class="kw2" style="font-family: 'Courier New', Courier, monospace; font-size: 13px; font-weight: bold; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">function</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;"> addImageToAlbum</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$image_path</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">,</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$message</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">,</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$album_name</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">{</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$app_id</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st0" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">"id here"</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$app_secret</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st0" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">"secret here"</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$post_login_url</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st0" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">"http://localhost/WCSERVER/index.php"</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$album_name</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$album_name</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$album_description</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$message</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$code</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$_REQUEST</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">[</span><span class="st0" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">"code"</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">]</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="co1" style="color: #666666; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">//Obtain the access_token with publish_stream permission </span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw1" style="color: #b1b100; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">if</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><a href="http://www.php.net/empty" style="color: #000066; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"><span class="kw3" style="color: #990000;">empty</span></a><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$code</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">{</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$dialog_url</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st0" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">"http://www.facebook.com/dialog/oauth?"</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st0" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">"client_id="</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$app_id</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st0" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">"&redirect_uri="</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><a href="http://www.php.net/urlencode" style="color: #000066; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"><span class="kw3" style="color: #990000;">urlencode</span></a><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$post_login_url</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st0" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">"&scope=publish_stream"</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw1" style="color: #b1b100; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">echo</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="st0" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">"<script>top.location.href='"</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$dialog_url</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st0" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">"'</script>"</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">}</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw1" style="color: #b1b100; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">else</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">{</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$token_url</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st0" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">"https://graph.facebook.com/oauth/"</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st0" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">"access_token?"</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st0" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">"client_id="</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$app_id</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st0" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">"&redirect_uri="</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><a href="http://www.php.net/urlencode" style="color: #000066; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"><span class="kw3" style="color: #990000;">urlencode</span></a><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$post_login_url</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st0" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">"&client_secret="</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$app_secret</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st0" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">"&code="</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$code</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$response</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><a href="http://www.php.net/file_get_contents" style="color: #000066; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"><span class="kw3" style="color: #990000;">file_get_contents</span></a><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$token_url</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$params</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw4" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; font-weight: bold; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">null</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><a href="http://www.php.net/parse_str" style="color: #000066; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"><span class="kw3" style="color: #990000;">parse_str</span></a><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$response</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">,</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$params</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$access_token</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$params</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">[</span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'access_token'</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">]</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="co1" style="color: #666666; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">// Create a new album</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$graph_url</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st0" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">"https://graph.facebook.com/me/albums?"</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st0" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">"access_token="</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$access_token</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$postdata</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><a href="http://www.php.net/http_build_query" style="color: #000066; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"><span class="kw3" style="color: #990000;">http_build_query</span></a><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><a href="http://www.php.net/array" style="color: #000066; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"><span class="kw3" style="color: #990000;">array</span></a><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'name'</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=></span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$album_name</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">,</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'message'</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=></span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$album_description</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$opts</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><a href="http://www.php.net/array" style="color: #000066; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"><span class="kw3" style="color: #990000;">array</span></a><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'http'</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=></span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><a href="http://www.php.net/array" style="color: #000066; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"><span class="kw3" style="color: #990000;">array</span></a><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'method'</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=></span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'POST'</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">,</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'header'</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=></span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'Content-type: application/x-www-form-urlencoded'</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">,</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'content'</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=></span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$postdata</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$context</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><a href="http://www.php.net/stream_context_create" style="color: #000066; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"><span class="kw3" style="color: #990000;">stream_context_create</span></a><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$opts</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$result</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><a href="http://www.php.net/json_decode" style="color: #000066; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"><span class="kw3" style="color: #990000;">json_decode</span></a><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><a href="http://www.php.net/file_get_contents" style="color: #000066; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"><span class="kw3" style="color: #990000;">file_get_contents</span></a><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">(</span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$graph_url</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">,</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw4" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; font-weight: bold; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">false</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">,</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$context</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">)</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="co1" style="color: #666666; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">// Get the new album ID</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$album_id</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$result</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">-></span><span class="me1" style="color: #004000; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">id</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="co1" style="color: #666666; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">//Show photo upload form and post to the Graph URL</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$graph_url</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">=</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st0" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">"https://graph.facebook.com/"</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$album_id</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st0" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">"/photos?access_token="</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$access_token</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="co1" style="color: #666666; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">//echo $graph_url.'&message='.$message.'&source='.$image_path;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="co1" style="color: #666666; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">//file_get_contents($graph_url.'?message='.$message.'&source='.$image_path);</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw1" style="color: #b1b100; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">echo</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'<html><body>'</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw1" style="color: #b1b100; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">echo</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'<form target="_top" id="uploadPhotoForm" enctype="multipart/form-data" action="'</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$graph_url</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">' "method="POST">'</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw1" style="color: #b1b100; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">echo</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'<input name="source" type="file" value="'</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$image_path</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'"><br/><br/>'</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw1" style="color: #b1b100; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">echo</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'<input name="message" type="text"<br />
value="'</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="re0" style="color: #000088; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">$message</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">.</span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'"><br/><br/>'</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw1" style="color: #b1b100; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">echo</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'<input type="submit" value="Upload" /><br/>'</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw1" style="color: #b1b100; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">echo</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'</form>'</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw1" style="color: #b1b100; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">echo</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'</body></html>'</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="kw1" style="color: #b1b100; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">echo</span><span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;"> </span><span class="st_h" style="color: blue; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">'<script type="text/javascript"> document.getElementById("uploadPhotoForm").submit();<br />
</script>'</span><span class="sy0" style="color: #339933; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">;</span><br style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;" /><span class="br0" style="color: #009900; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; text-align: -webkit-auto; white-space: nowrap;">}</span></span></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6758919037271709591.post-59489762152700233892011-09-20T12:36:00.000-07:002011-09-20T12:36:22.292-07:00Execute array of mysql query using PHP<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="background-color: white; color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;"><span class="kw2" style="color: black; font-weight: bold;"><?php</span> <span class="kw2" style="color: black; font-weight: bold;">class</span> MySQLDB <span class="br0" style="color: #009900;">{</span><br /> <span class="kw2" style="color: black; font-weight: bold;">private</span> <span class="re0" style="color: #000088;">$connection</span><span class="sy0" style="color: #339933;">;</span> <span class="co1" style="color: #666666; font-style: normal;">// The MySQL database connection</span><br /><br /> <span class="coMULTI" style="color: #666666; font-style: normal;">/* Class constructor */</span><br /> <span class="kw2" style="color: black; font-weight: bold;">function</span> MySQLDB<span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="br0" style="color: #009900;">{</span><br /> <span class="coMULTI" style="color: #666666; font-style: normal;">/* Make connection to database */</span><br /> <span class="re0" style="color: #000088;">$this</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">connection</span> <span class="sy0" style="color: #339933;">=</span> <a href="http://www.php.net/mysql_connect" style="color: #000066;"><span class="kw3" style="color: #990000;">mysql_connect</span></a><span class="br0" style="color: #009900;">(</span>DB_SERVER<span class="sy0" style="color: #339933;">,</span> DB_USER<span class="sy0" style="color: #339933;">,</span> DB_PASS<span class="br0" style="color: #009900;">)</span> or <a href="http://www.php.net/die" style="color: #000066;"><span class="kw3" style="color: #990000;">die</span></a><span class="br0" style="color: #009900;">(</span><a href="http://www.php.net/mysql_error" style="color: #000066;"><span class="kw3" style="color: #990000;">mysql_error</span></a><span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <a href="http://www.php.net/mysql_select_db" style="color: #000066;"><span class="kw3" style="color: #990000;">mysql_select_db</span></a><span class="br0" style="color: #009900;">(</span>DB_NAME<span class="sy0" style="color: #339933;">,</span> <span class="re0" style="color: #000088;">$this</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">connection</span><span class="br0" style="color: #009900;">)</span> or <a href="http://www.php.net/die" style="color: #000066;"><span class="kw3" style="color: #990000;">die</span></a><span class="br0" style="color: #009900;">(</span><a href="http://www.php.net/mysql_error" style="color: #000066;"><span class="kw3" style="color: #990000;">mysql_error</span></a><span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="br0" style="color: #009900;">}</span><br /><br /> <span class="coMULTI" style="color: #666666; font-style: normal;">/* Transactions functions */</span><br /><br /> <span class="kw2" style="color: black; font-weight: bold;">function</span> begin<span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="br0" style="color: #009900;">{</span><br /> <span class="re0" style="color: #000088;">$null</span> <span class="sy0" style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query" style="color: #000066;"><span class="kw3" style="color: #990000;">mysql_query</span></a><span class="br0" style="color: #009900;">(</span><span class="st0" style="color: blue;">"START TRANSACTION"</span><span class="sy0" style="color: #339933;">,</span> <span class="re0" style="color: #000088;">$this</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">connection</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="kw1" style="color: #b1b100;">return</span> <a href="http://www.php.net/mysql_query" style="color: #000066;"><span class="kw3" style="color: #990000;">mysql_query</span></a><span class="br0" style="color: #009900;">(</span><span class="st0" style="color: blue;">"BEGIN"</span><span class="sy0" style="color: #339933;">,</span> <span class="re0" style="color: #000088;">$this</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">connection</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="br0" style="color: #009900;">}</span><br /><br /> <span class="kw2" style="color: black; font-weight: bold;">function</span> commit<span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="br0" style="color: #009900;">{</span><br /> <span class="kw1" style="color: #b1b100;">return</span> <a href="http://www.php.net/mysql_query" style="color: #000066;"><span class="kw3" style="color: #990000;">mysql_query</span></a><span class="br0" style="color: #009900;">(</span><span class="st0" style="color: blue;">"COMMIT"</span><span class="sy0" style="color: #339933;">,</span> <span class="re0" style="color: #000088;">$this</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">connection</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="br0" style="color: #009900;">}</span><br /> <br /> <span class="kw2" style="color: black; font-weight: bold;">function</span> rollback<span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="br0" style="color: #009900;">{</span><br /> <span class="kw1" style="color: #b1b100;">return</span> <a href="http://www.php.net/mysql_query" style="color: #000066;"><span class="kw3" style="color: #990000;">mysql_query</span></a><span class="br0" style="color: #009900;">(</span><span class="st0" style="color: blue;">"ROLLBACK"</span><span class="sy0" style="color: #339933;">,</span> <span class="re0" style="color: #000088;">$this</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">connection</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="br0" style="color: #009900;">}</span><br /><br /> <span class="kw2" style="color: black; font-weight: bold;">function</span> transaction<span class="br0" style="color: #009900;">(</span><span class="re0" style="color: #000088;">$q_array</span><span class="br0" style="color: #009900;">)</span><span class="br0" style="color: #009900;">{</span><br /> <span class="re0" style="color: #000088;">$retval</span> <span class="sy0" style="color: #339933;">=</span> <span class="nu0" style="color: #cc66cc;">1</span><span class="sy0" style="color: #339933;">;</span><br /><br /> <span class="re0" style="color: #000088;">$this</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">begin</span><span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /><br /> <span class="kw1" style="color: #b1b100;">foreach</span><span class="br0" style="color: #009900;">(</span><span class="re0" style="color: #000088;">$q_array</span> <span class="kw1" style="color: #b1b100;">as</span> <span class="re0" style="color: #000088;">$qa</span><span class="br0" style="color: #009900;">)</span><span class="br0" style="color: #009900;">{</span><br /> <span class="re0" style="color: #000088;">$result</span> <span class="sy0" style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query" style="color: #000066;"><span class="kw3" style="color: #990000;">mysql_query</span></a><span class="br0" style="color: #009900;">(</span><span class="re0" style="color: #000088;">$qa</span><span class="br0" style="color: #009900;">[</span><span class="st_h" style="color: blue;">'query'</span><span class="br0" style="color: #009900;">]</span><span class="sy0" style="color: #339933;">,</span> <span class="re0" style="color: #000088;">$this</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">connection</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="kw1" style="color: #b1b100;">if</span><span class="br0" style="color: #009900;">(</span><a href="http://www.php.net/mysql_affected_rows" style="color: #000066;"><span class="kw3" style="color: #990000;">mysql_affected_rows</span></a><span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span> <span class="sy0" style="color: #339933;">==</span> <span class="nu0" style="color: #cc66cc;">0</span><span class="br0" style="color: #009900;">)</span><span class="br0" style="color: #009900;">{</span> <span class="re0" style="color: #000088;">$retval</span> <span class="sy0" style="color: #339933;">=</span> <span class="nu0" style="color: #cc66cc;">0</span><span class="sy0" style="color: #339933;">;</span> <span class="br0" style="color: #009900;">}</span><br /> <span class="br0" style="color: #009900;">}</span><br /><br /> <span class="kw1" style="color: #b1b100;">if</span><span class="br0" style="color: #009900;">(</span><span class="re0" style="color: #000088;">$retval</span> <span class="sy0" style="color: #339933;">==</span> <span class="nu0" style="color: #cc66cc;">0</span><span class="br0" style="color: #009900;">)</span><span class="br0" style="color: #009900;">{</span><br /> <span class="re0" style="color: #000088;">$this</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">rollback</span><span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="kw1" style="color: #b1b100;">return</span> <span class="kw4" style="color: #009900; font-weight: bold;">false</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="br0" style="color: #009900;">}</span><span class="kw1" style="color: #b1b100;">else</span><span class="br0" style="color: #009900;">{</span><br /> <span class="re0" style="color: #000088;">$this</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">commit</span><span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="kw1" style="color: #b1b100;">return</span> <span class="kw4" style="color: #009900; font-weight: bold;">true</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="br0" style="color: #009900;">}</span><br /> <span class="br0" style="color: #009900;">}</span><br /><br /><span class="br0" style="color: #009900;">}</span><span class="sy0" style="color: #339933;">;</span><br /><span class="coMULTI" style="color: #666666; font-style: normal;">/* Create database connection object */</span> <span class="re0" style="color: #000088;">$database</span> <span class="sy0" style="color: #339933;">=</span> <span class="kw2" style="color: black; font-weight: bold;">new</span> MySQLDB<span class="sy0" style="color: #339933;">;</span><br /><span class="co1" style="color: #666666; font-style: normal;">// then from anywhere else simply put the transaction queries in an array or arrays like this:</span><br /><br /> <span class="kw2" style="color: black; font-weight: bold;">function</span> <span class="kw2" style="color: black; font-weight: bold;">function</span><span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="br0" style="color: #009900;">{</span><br /> <span class="kw2" style="color: black; font-weight: bold;">global</span> <span class="re0" style="color: #000088;">$database</span><span class="sy0" style="color: #339933;">;</span><br /><br /> <span class="re0" style="color: #000088;">$q</span> <span class="sy0" style="color: #339933;">=</span> <a href="http://www.php.net/array" style="color: #000066;"><span class="kw3" style="color: #990000;">array</span></a> <span class="br0" style="color: #009900;">(</span><br /> <a href="http://www.php.net/array" style="color: #000066;"><span class="kw3" style="color: #990000;">array</span></a><span class="br0" style="color: #009900;">(</span><span class="st0" style="color: blue;">"query"</span> <span class="sy0" style="color: #339933;">=></span> <span class="st0" style="color: blue;">"UPDATE table WHERE something = 'something'"</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">,</span><br /> <a href="http://www.php.net/array" style="color: #000066;"><span class="kw3" style="color: #990000;">array</span></a><span class="br0" style="color: #009900;">(</span><span class="st0" style="color: blue;">"query"</span> <span class="sy0" style="color: #339933;">=></span> <span class="st0" style="color: blue;">"UPDATE table WHERE something_else = 'something_else'"</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">,</span><br /> <a href="http://www.php.net/array" style="color: #000066;"><span class="kw3" style="color: #990000;">array</span></a><span class="br0" style="color: #009900;">(</span><span class="st0" style="color: blue;">"query"</span> <span class="sy0" style="color: #339933;">=></span> <span class="st0" style="color: blue;">"DELETE FROM table WHERE something_else2 = 'something_else2'"</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">,</span><br /> <span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /><br /> <span class="re0" style="color: #000088;">$database</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">transaction</span><span class="br0" style="color: #009900;">(</span><span class="re0" style="color: #000088;">$q</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /><br /> <span class="br0" style="color: #009900;">}</span> <span class="sy1" style="color: black; font-weight: bold;">?></span></span></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6758919037271709591.post-23768589771778573942011-09-14T01:10:00.001-07:002011-10-31T07:59:36.342-07:00PHP debug function<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="background-color: white; color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;"><span class="kw2" style="color: black; font-weight: bold;">function</span> debug<span class="br0" style="color: #009900;">(</span><span class="re0" style="color: #000088;">$value</span><span class="br0" style="color: #009900;">)</span> <span class="br0" style="color: #009900;">{</span><br /> <span class="re0" style="color: #000088;">$btr</span><span class="sy0" style="color: #339933;">=</span><a href="http://www.php.net/debug_backtrace" style="color: #000066;"><span class="kw3" style="color: #990000;">debug_backtrace</span></a><span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="re0" style="color: #000088;">$line</span><span class="sy0" style="color: #339933;">=</span><span class="re0" style="color: #000088;">$btr</span><span class="br0" style="color: #009900;">[</span><span class="nu0" style="color: #cc66cc;">0</span><span class="br0" style="color: #009900;">]</span><span class="br0" style="color: #009900;">[</span><span class="st_h" style="color: blue;">'line'</span><span class="br0" style="color: #009900;">]</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="re0" style="color: #000088;">$file</span><span class="sy0" style="color: #339933;">=</span><a href="http://www.php.net/basename" style="color: #000066;"><span class="kw3" style="color: #990000;">basename</span></a><span class="br0" style="color: #009900;">(</span><span class="re0" style="color: #000088;">$btr</span><span class="br0" style="color: #009900;">[</span><span class="nu0" style="color: #cc66cc;">0</span><span class="br0" style="color: #009900;">]</span><span class="br0" style="color: #009900;">[</span><span class="st_h" style="color: blue;">'file'</span><span class="br0" style="color: #009900;">]</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="kw1" style="color: #b1b100;">print</span><span class="st0" style="color: blue;">"<pre><span class="es4" style="color: #006699; font-weight: bold;">$file</span>:<span class="es4" style="color: #006699; font-weight: bold;">$line</span></pre><span class="es1" style="color: #000099; font-weight: bold;">\n</span>"</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="kw1" style="color: #b1b100;">if</span><span class="br0" style="color: #009900;">(</span><a href="http://www.php.net/is_array" style="color: #000066;"><span class="kw3" style="color: #990000;">is_array</span></a><span class="br0" style="color: #009900;">(</span><span class="re0" style="color: #000088;">$value</span><span class="br0" style="color: #009900;">)</span><span class="br0" style="color: #009900;">)</span> <span class="br0" style="color: #009900;">{</span><br /> <span class="kw1" style="color: #b1b100;">print</span><span class="st0" style="color: blue;">"<pre>"</span><span class="sy0" style="color: #339933;">;</span><br /> <a href="http://www.php.net/print_r" style="color: #000066;"><span class="kw3" style="color: #990000;">print_r</span></a><span class="br0" style="color: #009900;">(</span><span class="re0" style="color: #000088;">$value</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="kw1" style="color: #b1b100;">print</span><span class="st0" style="color: blue;">"</pre><span class="es1" style="color: #000099; font-weight: bold;">\n</span>"</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="br0" style="color: #009900;">}</span> <span class="kw1" style="color: #b1b100;">elseif</span> <span class="br0" style="color: #009900;">(</span><a href="http://www.php.net/is_object" style="color: #000066;"><span class="kw3" style="color: #990000;">is_object</span></a><span class="br0" style="color: #009900;">(</span><span class="re0" style="color: #000088;">$value</span><span class="br0" style="color: #009900;">)</span><span class="br0" style="color: #009900;">)</span> <span class="br0" style="color: #009900;">{</span><br /> <span class="re0" style="color: #000088;">$value</span><span class="sy0" style="color: #339933;">.</span>dump<span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="br0" style="color: #009900;">}</span> <span class="kw1" style="color: #b1b100;">else</span> <span class="br0" style="color: #009900;">{</span><br /> <span class="kw1" style="color: #b1b100;">print</span><span class="br0" style="color: #009900;">(</span><span class="st0" style="color: blue;">"<p>&gt;<span class="es4" style="color: #006699; font-weight: bold;">${value}</span>&lt;</p>"</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="br0" style="color: #009900;">}</span><br /><span class="br0" style="color: #009900;">}</span></span><br />
<div>
<span class="Apple-style-span" style="background-color: #f0f0f0; color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;"><span class="br0" style="color: #009900;"><br /></span></span></div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6758919037271709591.post-51738992160894370792011-09-14T01:09:00.000-07:002011-10-31T07:59:53.436-07:00Call Store Proccedure<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="p1">
<span class="Apple-style-span" style="background-color: white; color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;"> <span class="co1" style="color: #666666; font-style: normal;">//FIRST WAY</span><br /> <span class="coMULTI" style="color: #666666; font-style: normal;"><br /> $dbConf = new DBConnection();<br /> $databaseURL = $dbConf->get_databaseURL();<br /> $databaseUName = $dbConf->get_databaseUName();<br /> $databasePWord = $dbConf->get_databasePWord();<br /> $databaseName = $dbConf->get_databaseName();<br /> <br /> $connection = mysql_connect($databaseURL, $databaseUName, $databasePWord);<br /> <br /> $db = mysql_select_db($databaseName, $connection);<br /><br /><br /> //$stmt = mssql_init("sp_GetObjectMasterData", $connection);<br /> $rs = mysql_query("CALL sp_GetObjectMasterData($p_user_id, $p_org_id, $p_ret_messaage, $p_ret_code)");<br /> <br /> if($rs) {<br /> while($row = mysql_fetch_assoc($rs))<br /> {<br /> echo $row;<br /> }<br /> return "Object ".$p_ret_messaage;<br /> } else {<br /> return "FALSE DATA";<br /> }</span><br /> <span class="re0" style="color: #000088;">$mysqli</span> <span class="sy0" style="color: #339933;">=</span> <span class="kw2" style="color: black; font-weight: bold;">new</span> mysqli<span class="br0" style="color: #009900;">(</span> <span class="st0" style="color: blue;">"XXXXXXXXX"</span><span class="sy0" style="color: #339933;">,</span> <span class="st0" style="color: blue;">"XXXXXXXX"</span><span class="sy0" style="color: #339933;">,</span> <span class="st0" style="color: blue;">"XXXXXXXX"</span><span class="sy0" style="color: #339933;">,</span> <span class="st0" style="color: blue;">"XXXXXXXXXXX"</span> <span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="re0" style="color: #000088;">$res</span> <span class="sy0" style="color: #339933;">=</span> <span class="re0" style="color: #000088;">$mysqli</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">multi_query</span><span class="br0" style="color: #009900;">(</span> <span class="st0" style="color: blue;">"CALL sp_GetObjectMasterData(<span class="es4" style="color: #006699; font-weight: bold;">$p_user_id</span>, <span class="es4" style="color: #006699; font-weight: bold;">$p_org_id</span>, @message, @code)"</span> <span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="kw1" style="color: #b1b100;">if</span><span class="br0" style="color: #009900;">(</span><span class="re0" style="color: #000088;">$res</span><span class="br0" style="color: #009900;">)</span> <span class="br0" style="color: #009900;">{</span><br /> <span class="re0" style="color: #000088;">$tableObjectArray</span> <span class="sy0" style="color: #339933;">=</span> <a href="http://www.php.net/array" style="color: #000066;"><span class="kw3" style="color: #990000;">array</span></a><span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="re0" style="color: #000088;">$tableArray</span> <span class="sy0" style="color: #339933;">=</span> <a href="http://www.php.net/array" style="color: #000066;"><span class="kw3" style="color: #990000;">array</span></a><span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="re0" style="color: #000088;">$results</span> <span class="sy0" style="color: #339933;">=</span> <span class="nu0" style="color: #cc66cc;">0</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="re0" style="color: #000088;">$countObj</span> <span class="sy0" style="color: #339933;">=</span> <span class="nu0" style="color: #cc66cc;">0</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="kw1" style="color: #b1b100;">do</span> <span class="br0" style="color: #009900;">{</span><br /> <span class="kw1" style="color: #b1b100;">if</span> <span class="br0" style="color: #009900;">(</span><span class="re0" style="color: #000088;">$result</span> <span class="sy0" style="color: #339933;">=</span> <span class="re0" style="color: #000088;">$mysqli</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">store_result</span><span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="br0" style="color: #009900;">)</span> <span class="br0" style="color: #009900;">{</span><br /> <span class="kw1" style="color: #b1b100;">while</span><span class="br0" style="color: #009900;">(</span> <span class="re0" style="color: #000088;">$row</span> <span class="sy0" style="color: #339933;">=</span> <span class="re0" style="color: #000088;">$result</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">fetch_row</span><span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span> <span class="br0" style="color: #009900;">)</span> <span class="br0" style="color: #009900;">{</span><br /> <span class="re0" style="color: #000088;">$tableObjectArray</span><span class="br0" style="color: #009900;">[</span><span class="re0" style="color: #000088;">$countObj</span><span class="br0" style="color: #009900;">]</span> <span class="sy0" style="color: #339933;">=</span> <span class="re0" style="color: #000088;">$row</span><span class="br0" style="color: #009900;">[</span><span class="nu0" style="color: #cc66cc;">0</span><span class="br0" style="color: #009900;">]</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="re0" style="color: #000088;">$tableArray</span><span class="br0" style="color: #009900;">[</span><span class="re0" style="color: #000088;">$countObj</span><span class="br0" style="color: #009900;">]</span> <span class="sy0" style="color: #339933;">=</span> <span class="re0" style="color: #000088;">$row</span><span class="br0" style="color: #009900;">[</span><span class="nu0" style="color: #cc66cc;">1</span><span class="br0" style="color: #009900;">]</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="re0" style="color: #000088;">$countObj</span><span class="sy0" style="color: #339933;">++;</span><br /> <span class="br0" style="color: #009900;">}</span><br /> <span class="re0" style="color: #000088;">$result</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">close</span><span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="kw1" style="color: #b1b100;">if</span><span class="br0" style="color: #009900;">(</span> <span class="re0" style="color: #000088;">$mysqli</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">more_results</span><span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span> <span class="br0" style="color: #009900;">)</span> <span class="sy0" style="color: #339933;">;</span><br /> <span class="br0" style="color: #009900;">}</span><br /> <span class="br0" style="color: #009900;">}</span> <span class="kw1" style="color: #b1b100;">while</span><span class="br0" style="color: #009900;">(</span> <span class="re0" style="color: #000088;">$mysqli</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">next_result</span><span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span> <span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <br /> <span class="kw1" style="color: #b1b100;">if</span><span class="br0" style="color: #009900;">(</span><a href="http://www.php.net/count" style="color: #000066;"><span class="kw3" style="color: #990000;">count</span></a><span class="br0" style="color: #009900;">(</span><span class="re0" style="color: #000088;">$tableObjectArray</span><span class="br0" style="color: #009900;">)</span><span class="br0" style="color: #009900;">)</span> <span class="br0" style="color: #009900;">{</span><br /> <span class="re0" style="color: #000088;">$count</span> <span class="sy0" style="color: #339933;">=</span> <span class="nu0" style="color: #cc66cc;">0</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="re0" style="color: #000088;">$tempTableArray</span> <span class="sy0" style="color: #339933;">=</span> <a href="http://www.php.net/array" style="color: #000066;"><span class="kw3" style="color: #990000;">array</span></a><span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="kw1" style="color: #b1b100;">foreach</span><span class="br0" style="color: #009900;">(</span><span class="re0" style="color: #000088;">$tableArray</span> <span class="kw1" style="color: #b1b100;">as</span> <span class="re0" style="color: #000088;">$selectionTable</span><span class="br0" style="color: #009900;">)</span> <span class="br0" style="color: #009900;">{</span><br /> <span class="re0" style="color: #000088;">$selectionDataArray</span> <span class="sy0" style="color: #339933;">=</span> <a href="http://www.php.net/explode" style="color: #000066;"><span class="kw3" style="color: #990000;">explode</span></a><span class="br0" style="color: #009900;">(</span><span class="st_h" style="color: blue;">'~'</span><span class="sy0" style="color: #339933;">,</span> <span class="re0" style="color: #000088;">$selectionTable</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="re0" style="color: #000088;">$tempSelectionDataArray</span> <span class="sy0" style="color: #339933;">=</span> <a href="http://www.php.net/array" style="color: #000066;"><span class="kw3" style="color: #990000;">array</span></a><span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="kw1" style="color: #b1b100;">for</span><span class="br0" style="color: #009900;">(</span><span class="re0" style="color: #000088;">$i</span> <span class="sy0" style="color: #339933;">=</span> <span class="nu0" style="color: #cc66cc;">0</span><span class="sy0" style="color: #339933;">;</span> <span class="re0" style="color: #000088;">$i</span> <span class="sy0" style="color: #339933;"><</span> <a href="http://www.php.net/count" style="color: #000066;"><span class="kw3" style="color: #990000;">count</span></a><span class="br0" style="color: #009900;">(</span><span class="re0" style="color: #000088;">$selectionDataArray</span><span class="br0" style="color: #009900;">)</span> <span class="sy0" style="color: #339933;">-</span> <span class="nu0" style="color: #cc66cc;">1</span><span class="sy0" style="color: #339933;">;</span> <span class="re0" style="color: #000088;">$i</span><span class="sy0" style="color: #339933;">++</span><span class="br0" style="color: #009900;">)</span> <span class="br0" style="color: #009900;">{</span><br /> <span class="re0" style="color: #000088;">$selectionData</span> <span class="sy0" style="color: #339933;">=</span> <a href="http://www.php.net/explode" style="color: #000066;"><span class="kw3" style="color: #990000;">explode</span></a><span class="br0" style="color: #009900;">(</span><span class="st_h" style="color: blue;">'|'</span><span class="sy0" style="color: #339933;">,</span> <span class="re0" style="color: #000088;">$selectionDataArray</span><span class="br0" style="color: #009900;">[</span><span class="re0" style="color: #000088;">$i</span><span class="br0" style="color: #009900;">]</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="re0" style="color: #000088;">$objectContainer</span> <span class="sy0" style="color: #339933;">=</span> <a href="http://www.php.net/array" style="color: #000066;"><span class="kw3" style="color: #990000;">array</span></a><span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="re0" style="color: #000088;">$objectContainer</span><span class="br0" style="color: #009900;">[</span><span class="nu0" style="color: #cc66cc;">0</span><span class="br0" style="color: #009900;">]</span> <span class="sy0" style="color: #339933;">=</span> <span class="re0" style="color: #000088;">$selectionData</span><span class="br0" style="color: #009900;">[</span><span class="nu0" style="color: #cc66cc;">0</span><span class="br0" style="color: #009900;">]</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="re0" style="color: #000088;">$objectContainer</span><span class="br0" style="color: #009900;">[</span><span class="nu0" style="color: #cc66cc;">1</span><span class="br0" style="color: #009900;">]</span> <span class="sy0" style="color: #339933;">=</span> <span class="re0" style="color: #000088;">$selectionData</span><span class="br0" style="color: #009900;">[</span><span class="nu0" style="color: #cc66cc;">1</span><span class="br0" style="color: #009900;">]</span><span class="sy0" style="color: #339933;">.</span><span class="st_h" style="color: blue;">'-'</span><span class="sy0" style="color: #339933;">.</span><span class="re0" style="color: #000088;">$selectionData</span><span class="br0" style="color: #009900;">[</span><span class="nu0" style="color: #cc66cc;">2</span><span class="br0" style="color: #009900;">]</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="re0" style="color: #000088;">$tempSelectionDataArray</span><span class="br0" style="color: #009900;">[</span><span class="re0" style="color: #000088;">$i</span><span class="br0" style="color: #009900;">]</span> <span class="sy0" style="color: #339933;">=</span> <span class="re0" style="color: #000088;">$objectContainer</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="br0" style="color: #009900;">}</span><br /> <span class="re0" style="color: #000088;">$tempTableArray</span><span class="br0" style="color: #009900;">[</span><span class="re0" style="color: #000088;">$tableObjectArray</span><span class="br0" style="color: #009900;">[</span><span class="re0" style="color: #000088;">$count</span><span class="br0" style="color: #009900;">]</span><span class="br0" style="color: #009900;">]</span> <span class="sy0" style="color: #339933;">=</span> <span class="re0" style="color: #000088;">$tempSelectionDataArray</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="re0" style="color: #000088;">$count</span><span class="sy0" style="color: #339933;">++;</span><br /> <span class="br0" style="color: #009900;">}</span><br /> <span class="re0" style="color: #000088;">$mysqli</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">close</span><span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="kw1" style="color: #b1b100;">return</span> <a href="http://www.php.net/json_encode" style="color: #000066;"><span class="kw3" style="color: #990000;">json_encode</span></a><span class="br0" style="color: #009900;">(</span><span class="re0" style="color: #000088;">$tempTableArray</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="br0" style="color: #009900;">}</span> <span class="kw1" style="color: #b1b100;">else</span> <span class="br0" style="color: #009900;">{</span><br /> <span class="re0" style="color: #000088;">$mysqli</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">close</span><span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="kw1" style="color: #b1b100;">return</span> <span class="st0" style="color: blue;">"false"</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="br0" style="color: #009900;">}</span><br /> <br /> <span class="br0" style="color: #009900;">}</span> <span class="kw1" style="color: #b1b100;">else</span> <span class="br0" style="color: #009900;">{</span><br /> <span class="re0" style="color: #000088;">$mysqli</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">close</span><span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="kw1" style="color: #b1b100;">return</span> <span class="st0" style="color: blue;">"false"</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="br0" style="color: #009900;">}</span><br /> <br /> <br /> <br /> <span class="co1" style="color: #666666; font-style: normal;">//SECOND WAY</span><br /> <span class="coMULTI" style="color: #666666; font-style: normal;">/*<br /> $mysql = mysql_connect('174.122.129.141', 'henrik_mcgm', 'mcgm8899', false, 65536);<br /> mysql_select_db('henrik_mcgm', $mysql);<br /> $rs = mysql_query("CALL henrik_mcgm.sp_GetObjectMasterData(212233385,6335572, @message, @code)");<br /> echo $rs;<br /> while($row = mysql_fetch_assoc($rs))<br /> {<br /> echo $row;<br /> }<br /> */</span><br /> <span class="co1" style="color: #666666; font-style: normal;">//THIRD WAY</span><br /> <span class="coMULTI" style="color: #666666; font-style: normal;">/* prepare the statement resource <br /> <br /> $dbConf = new DBConnection();<br /> $databaseURL = $dbConf->get_databaseURL();<br /> $databaseUName = $dbConf->get_databaseUName();<br /> $databasePWord = $dbConf->get_databasePWord();<br /> $databaseName = $dbConf->get_databaseName();<br /> <br /> $connection = mysql_connect($databaseURL, $databaseUName, $databasePWord);<br /> <br /> $db = mysql_select_db($databaseName, $connection);<br /> <br /> $stmt = mssql_init("sp_GetObjectMasterData", $connection);<br /> <br /> $p_ret_messaage = "";<br /> $p_ret_code = 0;<br /> <br /> <br /> mssql_bind($stmt, "@p_user_id", $p_user_id, SQLINT4);<br /> mssql_bind($stmt, "@p_org_id", $p_org_id, SQLINT4); //SQLVARCHAR<br /> mssql_bind($stmt, "@p_ret_messaage", $p_ret_messaage, SQLVARCHAR);<br /> mssql_bind($stmt, "@p_ret_code", $p_ret_code, SQLINT4); //SQLVARCHAR<br /> <br /> $result = mssql_execute($stmt);<br /> <br /> echo $p_ret_messaage;<br /> echo $p_ret_code;<br /> // Fetch Return Data And Place Into Array For Access<br /> $procedureResponseData = mssql_fetch_object($result);<br /> <br /> mysql_close($connection);<br /> <br /> return 'Response: '.$procedureResponseData; */</span><br /> <br /> <span class="co1" style="color: #666666; font-style: normal;">//LOCAL TEST</span><br /> <span class="coMULTI" style="color: #666666; font-style: normal;">/*<br /> $mysql = mysql_connect('localhost', '', '', false, 65536); //,false,65536 // add this to fix issue with recordsets<br /> mysql_select_db('test', $mysql);<br /> print '<h3>MYSQL: simple select</h3>';<br /> $rs = mysql_query('SELECT * FROM users;');<br /> while($row = mysql_fetch_assoc($rs))<br /> {<br /> echo $row['users_id'];<br /> echo $row['first_name'];<br /> echo $row['last_name'];<br /> }<br /> print '<h3>MYSQL: calling store procedure with out variables</h3>';<br /> $rs = mysql_query('CALL get_user(1, @first, @last)');<br /> $rs = mysql_query('SELECT @first, @last');<br /> while($row = mysql_fetch_assoc($rs))<br /> {<br /> echo $row;<br /> }<br /> print '<h3>MYSQL: calling store procedure returning a recordset – doesn\'t work</h3>';<br /> $rs = mysql_query('CALL get_users()');<br /> while($row = mysql_fetch_assoc($rs))<br /> {<br /> echo $row;<br /> }<br /> */</span><br /><br /> <span class="coMULTI" style="color: #666666; font-style: normal;">/*<br />// MYSQLI<br />$mysqli = new mysqli('localhost', '', '', 'test');<br /><br />$rs = $mysqli->query( 'SELECT * FROM users;' );<br />while($row = $rs->fetch_object())<br />{<br /> print_r($row);<br />}<br /><br />$rs = $mysqli->query( 'CALL get_user(1, @first, @last)' );<br />$rs = $mysqli->query( 'SELECT @first, @last' );<br />while($row = $rs->fetch_object())<br />{<br /> print_r($row);<br />}<br /><br />$rs = $mysqli->query( 'CALL get_users()' );<br />while($row = $rs->fetch_object())<br />{<br /> print_r($row);<br />}<br />*/</span></span></div>
<div>
<span class="Apple-style-span" style="background-color: #f0f0f0; color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;"><span class="coMULTI" style="color: #666666; font-style: normal;"><br /></span></span><br />
<span class="Apple-style-span" style="background-color: #f0f0f0; color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;"><span class="coMULTI" style="color: #666666; font-style: normal;">
</span></span><br />
<div class="p1">
<span class="Apple-style-span" style="background-color: #f0f0f0; color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;"><span class="coMULTI" style="color: #666666; font-style: normal;"><span class="s1"><span class="Apple-tab-span"> </span>$procedureResponseData = </span>"|1|M|Manhole~|2|L|Lamp hole~|3|G|Ghost Node~|4|O|Outfall~|5|S|Storm Overflow~|6|P|Pumping Station~|7|W|WWTF~|8|Z|Manhole of RM~|9|J|Junction Box~|10|B|Balancing Chamber~|11|V|Vent Shaft~#</span></span></div>
<span class="Apple-style-span" style="background-color: #f0f0f0; color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;"><span class="coMULTI" style="color: #666666; font-style: normal;">
<div class="p1">
<span class="Apple-tab-span"> </span>|1|M|Manhole~|2|L|Lamp hole~|3|G|Ghost Node~|4|O|Outfall~|5|S|Storm Overflow~|6|P|Pumping Station~|7|W|WWTF~|8|Z|Manhole of RM~|9|J|Junction Box~|10|B|Balancing Chamber~|11|V|Vent Shaft~#</div>
<div class="p1">
<span class="Apple-tab-span"> </span>|1|M|Manhole~|2|L|Lamp hole~|3|G|Ghost Node~|4|O|Outfall~|5|S|Storm Overflow~|6|P|Pumping Station~|7|W|WWTF~|8|Z|Manhole of RM~|9|J|Junction Box~|10|B|Balancing Chamber~|11|V|Vent Shaft~#</div>
<div class="p1">
<span class="Apple-tab-span"> </span>|1|M|Manhole~|2|L|Lamp hole~|3|G|Ghost Node~|4|O|Outfall~|5|S|Storm Overflow~|6|P|Pumping Station~|7|W|WWTF~|8|Z|Manhole of RM~|9|J|Junction Box~|10|B|Balancing Chamber~|11|V|Vent Shaft~#</div>
<div class="p1">
<span class="Apple-tab-span"> </span>|1|M|Manhole~|2|L|Lamp hole~|3|G|Ghost Node~|4|O|Outfall~|5|S|Storm Overflow~|6|P|Pumping Station~|7|W|WWTF~|8|Z|Manhole of RM~|9|J|Junction Box~|10|B|Balancing Chamber~|11|V|Vent Shaft~#</div>
<div class="p1">
<span class="Apple-tab-span"> </span>|1|M|Manhole~|2|L|Lamp hole~|3|G|Ghost Node~|4|O|Outfall~|5|S|Storm Overflow~|6|P|Pumping Station~|7|W|WWTF~|8|Z|Manhole of RM~|9|J|Junction Box~|10|B|Balancing Chamber~|11|V|Vent Shaft~#</div>
<div class="p1">
<span class="Apple-tab-span"> </span>|1|M|Manhole~|2|L|Lamp hole~|3|G|Ghost Node~|4|O|Outfall~|5|S|Storm Overflow~|6|P|Pumping Station~|7|W|WWTF~|8|Z|Manhole of RM~|9|J|Junction Box~|10|B|Balancing Chamber~|11|V|Vent Shaft~#</div>
<div class="p1">
<span class="Apple-tab-span"> </span>|1|M|Manhole~|2|L|Lamp hole~|3|G|Ghost Node~|4|O|Outfall~|5|S|Storm Overflow~|6|P|Pumping Station~|7|W|WWTF~|8|Z|Manhole of RM~|9|J|Junction Box~|10|B|Balancing Chamber~|11|V|Vent Shaft~"<span class="s1">;</span></div>
<div class="p2">
<span class="Apple-tab-span"> </span></div>
<div class="p1">
<span class="s1"><span class="Apple-tab-span"> </span>$tableObjectArray = </span><span class="s2">array</span><span class="s1">(0 => </span>'object_node_status_master'<span class="s1">, 1 => </span>'object_node_type_master'<span class="s1">, 2 => </span>'object_ward_master'<span class="s1">, 3 => </span>'object_manhole_shape_master'<span class="s1">,</span></div>
<div class="p1">
<span class="s1"><span class="Apple-tab-span"> </span>4 => </span>'object_soffit_master'<span class="s1">, 5 => </span>'object_cover_shape_master'<span class="s1">, 6 => </span>'object_connection_code_master'<span class="s1">, 7 => </span>'object_lining_material_code_master'<span class="s1">,</span></div>
<div class="p1">
<span class="s1"><span class="Apple-tab-span"> </span>8 => </span>'object_pipe_material_code_master'<span class="s1">, 9 => </span>'object_pipe_shape_master'<span class="s1">);</span></div>
<div class="p2">
<span class="Apple-tab-span"> </span></div>
<div class="p3">
<span class="Apple-tab-span"> </span>$tableArray = explode(<span class="s3">'#'</span>, $procedureResponseData);</div>
<div class="p3">
<span class="Apple-tab-span"> </span>$tempTableArray = <span class="s2">array</span>();</div>
<div class="p3">
<span class="Apple-tab-span"> </span>$count = 0;</div>
<div class="p3">
<span class="Apple-tab-span"> </span><span class="s2">foreach</span>($tableArray <span class="s2">as </span>$selectionTable) {</div>
<div class="p3">
<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>$selectionDataArray = explode(<span class="s3">'~'</span>, $selectionTable);</div>
<div class="p3">
<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>$tempSelectionDataArray = <span class="s2">array</span>();</div>
<div class="p3">
<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s2">for</span>($i = 0; $i < count($selectionDataArray) - 1; $i++) {</div>
<div class="p3">
<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>$selectionData<span class="Apple-tab-span"> </span>= explode(<span class="s3">'|'</span>, $selectionDataArray[$i]);</div>
<div class="p3">
<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>$objectContainer = <span class="s2">array</span>();</div>
<div class="p3">
<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>$objectContainer[0] = $selectionData[1];</div>
<div class="p3">
<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>$objectContainer[1] = $selectionData[2].<span class="s3">'-'</span>.$selectionData[3];</div>
<div class="p3">
<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>$tempSelectionDataArray[$i] = $objectContainer;</div>
<div class="p3">
<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>}</div>
<div class="p3">
<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>$tempTableArray[$tableObjectArray[$count]] = $tempSelectionDataArray; </div>
<div class="p3">
<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>$count++;</div>
<div class="p3">
<span class="Apple-tab-span"> </span>}</div>
<div class="p3">
<span class="Apple-tab-span"> </span><span class="s2">return </span>json_encode($tempTableArray); </div>
</span></span></div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6758919037271709591.post-86502120804195772402011-09-13T01:03:00.000-07:002011-10-31T07:59:53.446-07:00Execute Store Procedure Using PHP<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="background-color: white; color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;"><span class="kw2" style="color: black; font-weight: bold;"><?php</span><br /><span class="kw2" style="color: black; font-weight: bold;">function</span> <span class="sy0" style="color: #339933;">&</span>get_conn<span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><br /><span class="br0" style="color: #009900;">{</span><br /> <span class="kw2" style="color: black; font-weight: bold;">global</span> <span class="re0" style="color: #000088;">$conn</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="re0" style="color: #000088;">$myServer</span> <span class="sy0" style="color: #339933;">=</span> <span class="st0" style="color: blue;">"localhost"</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="re0" style="color: #000088;">$myUser</span> <span class="sy0" style="color: #339933;">=</span> <span class="st0" style="color: blue;">"markuser"</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="re0" style="color: #000088;">$myPass</span> <span class="sy0" style="color: #339933;">=</span> <span class="st0" style="color: blue;">"markpass"</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="re0" style="color: #000088;">$myDB</span> <span class="sy0" style="color: #339933;">=</span> <span class="st0" style="color: blue;">"markdb"</span><span class="sy0" style="color: #339933;">;</span><br /><br /> <span class="kw1" style="color: #b1b100;">if</span><span class="br0" style="color: #009900;">(</span><span class="sy0" style="color: #339933;">!</span><span class="re0" style="color: #000088;">$conn</span><span class="br0" style="color: #009900;">)</span><br /> <span class="br0" style="color: #009900;">{</span><br /> <span class="re0" style="color: #000088;">$conn</span> <span class="sy0" style="color: #339933;">=</span> <a href="http://www.php.net/mssql_connect" style="color: #000066;"><span class="kw3" style="color: #990000;">mssql_connect</span></a><span class="br0" style="color: #009900;">(</span><span class="re0" style="color: #000088;">$myServer</span><span class="sy0" style="color: #339933;">,</span> <span class="re0" style="color: #000088;">$myUser</span><span class="sy0" style="color: #339933;">,</span> <span class="re0" style="color: #000088;">$myPass</span><span class="br0" style="color: #009900;">)</span><br /> or <a href="http://www.php.net/die" style="color: #000066;"><span class="kw3" style="color: #990000;">die</span></a><span class="br0" style="color: #009900;">(</span><span class="st0" style="color: blue;">"Couldn't connect to SQL Server on <span class="es4" style="color: #006699; font-weight: bold;">$myServer</span>"</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <a href="http://www.php.net/mssql_select_db" style="color: #000066;"><span class="kw3" style="color: #990000;">mssql_select_db</span></a><span class="br0" style="color: #009900;">(</span><span class="re0" style="color: #000088;">$myDB</span><span class="sy0" style="color: #339933;">,</span> <span class="re0" style="color: #000088;">$conn</span><span class="br0" style="color: #009900;">)</span><br /> or <a href="http://www.php.net/die" style="color: #000066;"><span class="kw3" style="color: #990000;">die</span></a><span class="br0" style="color: #009900;">(</span><span class="st0" style="color: blue;">"Couldn't select database <span class="es4" style="color: #006699; font-weight: bold;">$myDB</span>"</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /> <span class="br0" style="color: #009900;">}</span><br /> <span class="kw1" style="color: #b1b100;">return</span> <span class="re0" style="color: #000088;">$conn</span><span class="sy0" style="color: #339933;">;</span><br /><span class="br0" style="color: #009900;">}</span><br /><br /><span class="coMULTI" style="color: #666666; font-style: normal;">/* get a connection */</span><br /><span class="re0" style="color: #000088;">$conn</span> <span class="sy0" style="color: #339933;">=&</span> get_conn<span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /><span class="sy1" style="color: black; font-weight: bold;">?></span><br /><br />(Some of you may frown at the use of global $conn. I don’t normally use this, </span><br />
<span class="Apple-style-span" style="background-color: white; color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;">but it was a quick and dirty hack, not for production use….)<br /><br />So far, all pretty standard stuff.<br /><br />When executing a stored procedure, you have two choices.<br /><br />1. (BAD) Execute it as a standard SQL statement:<br /><br />EXEC myprocedure param1, param2, param3<br />or<br /><br />EXEC myprocedure @id=param1, @name=param2, @email=param3<br />This is great from the command line when using isql, or when using SQL query analyzer (damn the Americans and their Z’s!).<br /><br /></span><br />
<span class="Apple-style-span" style="background-color: white; color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;">2. (GOOD) A far more robust solution is to use the mssql_init, mssql_bind and </span><br />
<span class="Apple-style-span" style="background-color: white; color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;">mssql_execute methods, and bind named (and typed) parameters to your stored procedure object. </span><br />
<span class="Apple-style-span" style="background-color: white; color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;">The following snippet example gives you an idea of how to do this:<br /><br /><span class="kw2" style="color: black; font-weight: bold;"><?php</span><br /><span class="coMULTI" style="color: #666666; font-style: normal;">/* prepare the statement resource */</span><br /><span class="re0" style="color: #000088;">$stmt</span><span class="sy0" style="color: #339933;">=</span><a href="http://www.php.net/mssql_init" style="color: #000066;"><span class="kw3" style="color: #990000;">mssql_init</span></a><span class="br0" style="color: #009900;">(</span><span class="st0" style="color: blue;">"myprocedure"</span><span class="sy0" style="color: #339933;">,</span> <span class="re0" style="color: #000088;">$conn</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /><br /><span class="coMULTI" style="color: #666666; font-style: normal;">/* now bind the parameters to it */</span><br /><a href="http://www.php.net/mssql_bind" style="color: #000066;"><span class="kw3" style="color: #990000;">mssql_bind</span></a><span class="br0" style="color: #009900;">(</span><span class="re0" style="color: #000088;">$stmt</span><span class="sy0" style="color: #339933;">,</span> <span class="st0" style="color: blue;">"@id"</span><span class="sy0" style="color: #339933;">,</span> <span class="re0" style="color: #000088;">$id</span><span class="sy0" style="color: #339933;">,</span> SQLINT4<span class="sy0" style="color: #339933;">,</span> <span class="kw4" style="color: #009900; font-weight: bold;">FALSE</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /><a href="http://www.php.net/mssql_bind" style="color: #000066;"><span class="kw3" style="color: #990000;">mssql_bind</span></a><span class="br0" style="color: #009900;">(</span><span class="re0" style="color: #000088;">$stmt</span><span class="sy0" style="color: #339933;">,</span> <span class="st0" style="color: blue;">"@name"</span><span class="sy0" style="color: #339933;">,</span> <span class="re0" style="color: #000088;">$name</span><span class="sy0" style="color: #339933;">,</span> SQLVARCHAR<span class="sy0" style="color: #339933;">,</span> <span class="kw4" style="color: #009900; font-weight: bold;">FALSE</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /><a href="http://www.php.net/mssql_bind" style="color: #000066;"><span class="kw3" style="color: #990000;">mssql_bind</span></a><span class="br0" style="color: #009900;">(</span><span class="re0" style="color: #000088;">$stmt</span><span class="sy0" style="color: #339933;">,</span> <span class="st0" style="color: blue;">"@email"</span><span class="sy0" style="color: #339933;">,</span> <span class="re0" style="color: #000088;">$email</span><span class="sy0" style="color: #339933;">,</span> SQLVARCHAR<span class="sy0" style="color: #339933;">,</span> <span class="kw4" style="color: #009900; font-weight: bold;">FALSE</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span> <br /><br /><span class="coMULTI" style="color: #666666; font-style: normal;">/* now execute the procedure */</span><br /><span class="re0" style="color: #000088;">$result</span> <span class="sy0" style="color: #339933;">=</span> <a href="http://www.php.net/mssql_execute" style="color: #000066;"><span class="kw3" style="color: #990000;">mssql_execute</span></a><span class="br0" style="color: #009900;">(</span><span class="re0" style="color: #000088;">$stmt</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /><span class="sy1" style="color: black; font-weight: bold;">?></span><br />There are two great benefits to using this approach:<br /><br />Security - You don’t have to worry about escaping characters (like apostrophes) in your variable names. This makes nasty things like SQL injection impossible.<br />Typed variables - If you try and put text in a field that should be an integer you will get an error. While nobody likes errors, it’s much better to get </span><br />
<span class="Apple-style-span" style="background-color: white; color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;">them here than at the database end.<br />So that’s it in a nutshell! I needed my stored procedure to return stuff to me,</span><br />
<span class="Apple-style-span" style="background-color: white; color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;">but I was having problems getting my output parameters to work. I’ve just seen the following in the online PHP documentation,</span><br />
<span class="Apple-style-span" style="background-color: white; color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;">posted by a chap called Matt, that may help here:<br /><br />1) you need to pass your php variable by reference. mssql_bind($stmt, "@outParam", &$outParam, true)<br /><br />2) php-4.3.1-win32 had a binding bug and output parameters do not bind. 4.1 and 4.3.2rc1 do not have the bug. I have not tested other versions.</span><br />
<div>
<span class="Apple-style-span" style="background-color: #f0f0f0; color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;"><br /></span></div>
<div>
<span class="Apple-style-span" style="background-color: white; color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;"><br /></span></div>
<div>
<span class="Apple-style-span" style="background-color: white; color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;">PHP Manual Reference :</span></div>
<div>
<span class="Apple-style-span" style="background-color: white; color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;"><br /></span></div>
<div>
<span class="Apple-style-span" style="color: #0000bb; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: nowrap;"><span class="Apple-style-span" style="background-color: white;">Example #4 Calling a stored procedure with an output parameter<br /><span class="kw2" style="color: black; font-weight: bold;"><?php</span><br /><span class="re0" style="color: #000088;">$stmt</span> <span class="sy0" style="color: #339933;">=</span> <span class="re0" style="color: #000088;">$dbh</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">prepare</span><span class="br0" style="color: #009900;">(</span><span class="st0" style="color: blue;">"CALL sp_returns_string(?)"</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /><span class="re0" style="color: #000088;">$stmt</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">bindParam</span><span class="br0" style="color: #009900;">(</span><span class="nu0" style="color: #cc66cc;">1</span><span class="sy0" style="color: #339933;">,</span> <span class="re0" style="color: #000088;">$return_value</span><span class="sy0" style="color: #339933;">,</span> PDO<span class="sy0" style="color: #339933;">::</span><span class="me2" style="color: #004000;">PARAM_STR</span><span class="sy0" style="color: #339933;">,</span> <span class="nu0" style="color: #cc66cc;">4000</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /><br /><span class="co1" style="color: #666666; font-style: normal;">// call the stored procedure</span><br /><span class="re0" style="color: #000088;">$stmt</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">execute</span><span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /><br /><span class="kw1" style="color: #b1b100;">print</span> <span class="st0" style="color: blue;">"procedure returned <span class="es4" style="color: #006699; font-weight: bold;">$return_value</span><span class="es1" style="color: #000099; font-weight: bold;">\n</span>"</span><span class="sy0" style="color: #339933;">;</span><br /><span class="sy1" style="color: black; font-weight: bold;">?></span><br />Developers may also specify parameters that hold values both input and output; the syntax is similar to output parameters. In this next example, the string 'hello' is passed into the stored procedure, and when it returns, hello is replaced with the return value of the procedure.<br /><br />Example #5 Calling a stored procedure with an input/output parameter<br /><span class="kw2" style="color: black; font-weight: bold;"><?php</span><br /><span class="re0" style="color: #000088;">$stmt</span> <span class="sy0" style="color: #339933;">=</span> <span class="re0" style="color: #000088;">$dbh</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">prepare</span><span class="br0" style="color: #009900;">(</span><span class="st0" style="color: blue;">"CALL sp_takes_string_returns_string(?)"</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /><span class="re0" style="color: #000088;">$value</span> <span class="sy0" style="color: #339933;">=</span> <span class="st_h" style="color: blue;">'hello'</span><span class="sy0" style="color: #339933;">;</span><br /><span class="re0" style="color: #000088;">$stmt</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">bindParam</span><span class="br0" style="color: #009900;">(</span><span class="nu0" style="color: #cc66cc;">1</span><span class="sy0" style="color: #339933;">,</span> <span class="re0" style="color: #000088;">$value</span><span class="sy0" style="color: #339933;">,</span> PDO<span class="sy0" style="color: #339933;">::</span><span class="me2" style="color: #004000;">PARAM_STR</span><span class="sy0" style="color: #339933;">|</span>PDO<span class="sy0" style="color: #339933;">::</span><span class="me2" style="color: #004000;">PARAM_INPUT_OUTPUT</span><span class="sy0" style="color: #339933;">,</span> <span class="nu0" style="color: #cc66cc;">4000</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span> </span><br /><span class="Apple-style-span" style="background-color: white;"><br /><span class="co1" style="color: #666666; font-style: normal;">// call the stored procedure</span><br /><span class="re0" style="color: #000088;">$stmt</span><span class="sy0" style="color: #339933;">-></span><span class="me1" style="color: #004000;">execute</span><span class="br0" style="color: #009900;">(</span><span class="br0" style="color: #009900;">)</span><span class="sy0" style="color: #339933;">;</span><br /><br /><span class="kw1" style="color: #b1b100;">print</span> <span class="st0" style="color: blue;">"procedure returned <span class="es4" style="color: #006699; font-weight: bold;">$value</span><span class="es1" style="color: #000099; font-weight: bold;">\n</span>"</span><span class="sy0" style="color: #339933;">;</span><br /><span class="sy1" style="color: black; font-weight: bold;">?></span></span></span></div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6758919037271709591.post-35188458842997651002011-07-26T08:42:00.000-07:002011-07-26T08:42:04.027-07:00BASE64URL variant encoding in php<div dir="ltr" style="text-align: left;" trbidi="on"><span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: "Times"; font-size: small; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="font-family: Consolas, 'Andale Mono WT', 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace; font-size: 14px; text-align: left;"><span class="default" style="background-color: transparent; color: #0000bb;"><?php<span class="Apple-converted-space"> </span></span><span class="keyword" style="background-color: transparent; color: #007700;">function<span class="Apple-converted-space"> </span></span><span class="default" style="background-color: transparent; color: #0000bb;">base64url_encode</span><span class="keyword" style="background-color: transparent; color: #007700;">(</span><span class="default" style="background-color: transparent; color: #0000bb;">$data</span><span class="keyword" style="background-color: transparent; color: #007700;">) {<span class="Apple-converted-space"> </span><br />
return<span class="Apple-converted-space"> </span></span><span class="default" style="background-color: transparent; color: #0000bb;">rtrim</span><span class="keyword" style="background-color: transparent; color: #007700;">(</span><span class="default" style="background-color: transparent; color: #0000bb;">strtr</span><span class="keyword" style="background-color: transparent; color: #007700;">(</span><span class="default" style="background-color: transparent; color: #0000bb;">base64_encode</span><span class="keyword" style="background-color: transparent; color: #007700;">(</span><span class="default" style="background-color: transparent; color: #0000bb;">$data</span><span class="keyword" style="background-color: transparent; color: #007700;">),<span class="Apple-converted-space"> </span></span><span class="string" style="background-color: transparent; color: #dd0000;">'+/'</span><span class="keyword" style="background-color: transparent; color: #007700;">,<span class="Apple-converted-space"> </span></span><span class="string" style="background-color: transparent; color: #dd0000;">'-_'</span><span class="keyword" style="background-color: transparent; color: #007700;">),<span class="Apple-converted-space"> </span></span><span class="string" style="background-color: transparent; color: #dd0000;">'='</span><span class="keyword" style="background-color: transparent; color: #007700;">);<span class="Apple-converted-space"> </span><br />
}<span class="Apple-converted-space"> </span><br />
<br />
function<span class="Apple-converted-space"> </span></span><span class="default" style="background-color: transparent; color: #0000bb;">base64url_decode</span><span class="keyword" style="background-color: transparent; color: #007700;">(</span><span class="default" style="background-color: transparent; color: #0000bb;">$data</span><span class="keyword" style="background-color: transparent; color: #007700;">) {<span class="Apple-converted-space"> </span><br />
return<span class="Apple-converted-space"> </span></span><span class="default" style="background-color: transparent; color: #0000bb;">base64_decode</span><span class="keyword" style="background-color: transparent; color: #007700;">(</span><span class="default" style="background-color: transparent; color: #0000bb;">str_pad</span><span class="keyword" style="background-color: transparent; color: #007700;">(</span><span class="default" style="background-color: transparent; color: #0000bb;">strtr</span><span class="keyword" style="background-color: transparent; color: #007700;">(</span><span class="default" style="background-color: transparent; color: #0000bb;">$data</span><span class="keyword" style="background-color: transparent; color: #007700;">,<span class="Apple-converted-space"> </span></span><span class="string" style="background-color: transparent; color: #dd0000;">'-_'</span><span class="keyword" style="background-color: transparent; color: #007700;">,<span class="Apple-converted-space"> </span></span><span class="string" style="background-color: transparent; color: #dd0000;">'+/'</span><span class="keyword" style="background-color: transparent; color: #007700;">),<span class="Apple-converted-space"> </span></span><span class="default" style="background-color: transparent; color: #0000bb;">strlen</span><span class="keyword" style="background-color: transparent; color: #007700;">(</span><span class="default" style="background-color: transparent; color: #0000bb;">$data</span><span class="keyword" style="background-color: transparent; color: #007700;">) %<span class="Apple-converted-space"> </span></span><span class="default" style="background-color: transparent; color: #0000bb;">4</span><span class="keyword" style="background-color: transparent; color: #007700;">,<span class="Apple-converted-space"> </span></span><span class="string" style="background-color: transparent; color: #dd0000;">'='</span><span class="keyword" style="background-color: transparent; color: #007700;">,<span class="Apple-converted-space"> </span></span><span class="default" style="background-color: transparent; color: #0000bb;">STR_PAD_RIGHT</span><span class="keyword" style="background-color: transparent; color: #007700;">));<span class="Apple-converted-space"> </span><br />
}<span class="Apple-converted-space"> </span></span><span class="default" style="background-color: transparent; color: #0000bb;">?></span></span></span></div>Unknownnoreply@blogger.com0