Search
Syndication
Sponsors

Posts Tagged ‘php’

PHP Interview Questions, Answers, and Explanations: PHP Certification Review: PHP FAQ

Friday, December 4th, 2009

PHP Interview Questions, Answers, and Explanations: PHP Certification Review: PHP FAQ
PHP Interview Questions, Answers, and Explanations: PHP Certification Review: PHP FAQ
Price: $58.46
PHP is a must-know for any programmer who wants to stay competitive in today’’s oversaturated market.

This reference is organized around application to both the production of dynamic Web pages and server-side application software.

More than 150 certification-type questions and answers are provided. (Computer Books)

PHP Interview Questions, Answers, and Explanations: PHP Certification Review: PHP FAQ

Ultra Hosting overview

Wednesday, April 15th, 2009

Big, fully featured website hosting plans beginning as low as only $3.95 a month! You don’t have to pay for six months to a year beforehand to get this great price unlike many hosting providers!

Have unlimited websites hosted for as low as $5.95 a month!

Have a need for speed? We love speed as much as you do! We run powerful Dell Intel Quad Xeon web servers with 4GB+ of RAM connected by a 18GB/s redundant backbone.

Check out Ultra Hosting plans here

Looking for features? We have you covered! Your own fully loaded online control panel, live online support, support forums, Perl, CGI-BIN, SSI, PHP5, JSP, mySQL databases, phpMyAdmin, Fantastico app installer, GD, ImageMagick, Curl, Zend Optimizer, mod rewrite, sub-domains, park domains, unlimited POP3 e-mail accounts, webmail, hot link protection, SPAM protection, virus protection, password protect directories, built in web stat programs, log file accessibility, custom error pages, automate tasks using cron interface, guestbook, site builder, free installable PHP forums, chat programs, bloggers, image galleries, support programs and much more!

From a php programming point of view ImageMagick, Curl, Zend Optimizer and MySQL support are key, on a broader note the JSP availability is fairly rare in hosts as well.

Check out Ultra Hosting plans here

Eboundhost PHP hosting

Wednesday, April 15th, 2009

Eboundhost offer a $3.95 package as well as other services such as dedicated servers and reseller programs

Key things are Unmetered bandwidth and web space, free domain name. Several scripts that can be installed such as wordpress.

Programming wise we have PHP 4 and 5, Perl, Ruby On Rails and 200 MySQL databases and 200 PostgreSQL databases

eBoundHost Web Hosting

Get Dow Jones stock market data

Tuesday, March 31st, 2009

This example retrieves the latest Dow Jones data from Yahoo finance when a page is loaded

Part 1 : The all important form

<html>
<head>
<script type=”text/javascript” src=”getdow.js”></script>
</head>
<body onLoad=”showDow(this.value)”>

Latest Dow Jones data:

<div id=”dowOutput”>
<b>
</b>
</div>
</p>
</body>
</html>

Part 2 : The JavaScript which in this case is in a file called getdow.js

var xmlHttp;
function showDow(str)
 {
 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
  {
  alert (”Browser does not support HTTP Request”);
  return;
  }
 var url=”getdow.php”;
 url=url+”?q=”+str;
 url=url+”&sid=”+Math.random();
 xmlHttp.onreadystatechange=stateChanged;
 xmlHttp.open(”GET”,url,true);
 xmlHttp.send(null);
 }

function stateChanged()
 {
 if (xmlHttp.readyState==4 || xmlHttp.readyState==”complete”)
  {
  document.getElementById(”dowOutput”)
  .innerHTML=xmlHttp.responseText;
  }
 }function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject(”Msxml2.XMLHTTP”);
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject(”Microsoft.XMLHTTP”);
  }
 }
return xmlHttp;
}

Part 3 : Finally the PHP part which is in a file called getdow.php

<?php
//get the q parameter from URL
$q=$_GET["q"];//find out which feed was selected

$fp = fopen (”http://download.finance.yahoo.com/d/quotes.csv?s=%5EDJI&f=sl1d1t1c1ohgv&e=.csv”,”r“);
$data = fgetcsv ($fp, 1000, “,”)
?>
<!– this is our table which displays the stock info –>
<!– we access the individual items by using $data[0]–>

<table>
<br/>
<tr><td>symbol</td><td><?php echo $data[0] ?></td></tr>
<tr><td>last price</td><td><?php echo $data[1] ?></td></tr>
<tr><td>date</td><td><?php echo $data[2] ?></td></tr>
<tr><td>time</td><td><?php echo $data[3] ?></td></tr>
<tr><td>change</td><td><?php echo $data[4] ?></td></tr>
<tr><td>open</td><td><?php echo $data[5] ?></td></tr>
<tr><td>high</td><td><?php echo $data[6] ?></td></tr>
<tr><td>low</td><td><?php echo $data[7] ?></td></tr>
<tr><td>volume</td><td><?php echo $data[8] ?></td></tr>
</table>
<br/>
Data courtesy of <a href=”http://finance.yahoo.com”>Yahoo finance</a>
<?php
//close the filehandle $fp
fclose ($fp);
?>

Ajax and PHP Stock Quote example

Monday, March 30th, 2009

This is  a new source code section so we thought what could we have as a useful first example using Ajax, PHP and a bit of JavaScript. A stock ticker example. Lets go

Part 1 : Is the form itself.

<html>
<head>
<script type=”text/javascript” src=”getstock.js”></script>
</head>
<body>
<form>
Enter your stock ticker symbol:
<input type=”text” id=”txt1″ size=”30″ onkeyup=”showQuote(this.value)”>
</form><p>
<div id=”stockOutput”>
<b>
</b>
</div>
</p>
</body>
</html>

Part 2 : This is the all important Javascript, in this example it is calles getstock.js

var xmlHttp;
function showQuote(str)
 {
 xmlHttp=GetXmlHttpObject();
 if (xmlHttp==null)
  {
  alert (”Browser does not support HTTP Request”);
  return;
  }
 var url=”getstock.php”;
 url=url+”?q=”+str;
 url=url+”&sid=”+Math.random();
 xmlHttp.onreadystatechange=stateChanged;
 xmlHttp.open(”GET”,url,true);
 xmlHttp.send(null);
 }

function stateChanged()
 {
 if (xmlHttp.readyState==4 || xmlHttp.readyState==”complete”)
  {
  document.getElementById(”stockOutput”)
  .innerHTML=xmlHttp.responseText;
  }
 }function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject(”Msxml2.XMLHTTP”);
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject(”Microsoft.XMLHTTP”);
  }
 }
return xmlHttp;
}

Part 3 : The bit were interested in, the PHP code again this is called getstock.php

<?php
//get the q parameter from URL
$q=$_GET["q"];//find out which feed was selected

$fp = fopen (”http://finance.yahoo.com/d/quotes.csv?s=$q&f=sl1d1t1c1ohgv&e=.csv”,”r“);
$data = fgetcsv ($fp, 1000, “,”)
?>
<!– this is our table which displays the stock info –>
<!– we access the individual items by using $data[0]–>
<html>
<head>
</head>
<body>
<table>
<tr><td>description</td><td>latest figure</td><tr>
<tr><td>symbol</td><td><?php echo $data[0] ?></td></tr>
<tr><td>last price</td><td><?php echo $data[1] ?></td></tr>
<tr><td>date</td><td><?php echo $data[2] ?></td></tr>
<tr><td>time</td><td><?php echo $data[3] ?></td></tr>
<tr><td>change</td><td><?php echo $data[4] ?></td></tr>
<tr><td>open</td><td><?php echo $data[5] ?></td></tr>
<tr><td>high</td><td><?php echo $data[6] ?></td></tr>
<tr><td>low</td><td><?php echo $data[7] ?></td></tr>
<tr><td>volume</td><td><?php echo $data[8] ?></td></tr>
</table>
<?php
//close the filehandle $fp
fclose ($fp);
?>

Want to see what it looks like, visit the link and start typing a ticker symbol (MSFT, GOOG are a 2 examples)

http://www.getphp.net/ajaxexamples/stock/stockform.php

Note if you use this add in a credit to Yahoo for kindly supplying the data.

P.S

We’ll discuss how this all works at a later date