By Dhiraj | June 19, 2008

WORKING WITH REST

rest-client.php <? $rs=”http://localhost/rest/rest-server.php”; $qs=”"; $parray=array(’amount’=>”15.00″); foreach($parray as $par=>$value){ $qs=$qs.”$par=”.urlencode($value).”&”; } $uri=”$rs?$qs” . “aid=01″; echo $qs . “<br>” . $uri . “<br>”; $cobj=curl_init($uri); curl_setopt($cobj,CURLOPT_RETURNTRANSFER,1); $xml=curl_exec($cobj); curl_close($cobj); echo htmlspecialchars($xml); ?> rest-server.php <? $amount=$_GET[”amount”]; if ($_GET[’aid’]!=”010915780″) { echo “Invalid A ID”; } else { $taxcalc=$amount; echo “<?xml version=\”1.0\”?>”; echo “<taxinfo>”; echo “<result>”.$taxcalc.”</result>”; echo “<result>”.$taxcalc * 20 .”</result>”; echo “</taxinfo>”; } ?> Test It.
By Dhiraj | June 19, 2008

AJAX GET IN PHP

var http_request = false; function makePOSTRequest(url) { http_request = false; if (window.XMLHttpRequest) { // Mozilla, Safari,… http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { // set type accordingly to anticipated content type //http_request.overrideMimeType(’text/xml’); http_request.overrideMimeType(’text/html’); } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject(”Msxml2.XMLHTTP”); } catch (e) { try { http_request = new ActiveXObject(”Microsoft.XMLHTTP”); } catch (e) {} } } if (!http_request) { alert(’Cannot create XMLHTTP instance’); return false; } http_request.onreadystatechange = alertContents; http_request.open(’GET’, url, true); http_request.send(null); } function [...]
By Dhiraj | June 19, 2008

How TO Handle Ajax POST With PHP

var http_request = false; function makePOSTRequest(url, parameters) { http_request = false; if (window.XMLHttpRequest) { // Mozilla, Safari,… http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { // set type accordingly to anticipated content type //http_request.overrideMimeType(’text/xml’); http_request.overrideMimeType(’text/html’); } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject(”Msxml2.XMLHTTP”); } catch (e) { try { http_request = new ActiveXObject(”Microsoft.XMLHTTP”); } catch (e) {} } } if (!http_request) { alert(’Cannot create XMLHTTP instance’); return false; } http_request.onreadystatechange = alertContents; http_request.open(’POST’, [...]
By Dhiraj | April 13, 2008

How To Trace Dynamic Page URL In PHP

// FUNCTION Starts …. function getPageURL() { $pageURL = ‘http’; if ($_SERVER[”HTTPS”] == “on”) {$pageURL .= “s”;} $pageURL .= “://”; if ($_SERVER[”SERVER_PORT”] != “80″) { $pageURL .= $_SERVER[”SERVER_NAME”].”:”.$_SERVER[”SERVER_PORT”].$_SERVER[”REQUEST_URI”]; } else { $pageURL .= $_SERVER[”SERVER_NAME”].$_SERVER[”REQUEST_URI”]; } return $pageURL; } } Note : Use This Funtion To Get The Dynamic Page URL.
By admin | January 26, 2008

Problemes With Iframe. And it’s solution

When we REFRESS web page containing IFRAME, the page reloades with the starting page. Here is the solution being in the existing page after refress. (PHP Script) Generally what happens, when we refress a web page containing IFRAME ? The page reloades with the starting page. Information provided in the existing page are lost. this is [...]
By admin | January 26, 2008

How To Access Cookie Without any special Charecters

Generally, when we access javascript, wild card charecters are replaced by some special symbols (like +,% etc). This code is for accessing cookie value withour any special chacters. Try It. //Reading Cookie function ReadCookie(n) { var cookiecontent = new String(); if(document.cookie.length > 0) {  var cookiename = n+ ‘=’;  var cookiebegin = document.cookie.indexOf(cookiename);  var cookieend = 0;  if(cookiebegin > -1) {   cookiebegin += [...]
By admin | January 26, 2008

Handling forms in Javascript

This lesson will give an idea how to start using javascripts in forms <HTML> <BODY> <SCRIPT LANGUAGE=javascript> <!–      function f1(){      document.write(MyForm.name,”<Br>”,MyForm.textname.value,”<Br>”,MyForm.length)      } //–> </SCRIPT> </BODY> <FORM action=”" method=POST name=MyForm onclick=”f1()”> <INPUT type=”text” name=textname value=”Broken Arrow”> </FORM> </HTML>
Ad

Calendar

November 2008
M T W T F S S
« Oct «-»  
 12
3456789
10111213141516
17181920212223
24252627282930

Search

Polls

  • Who will rule the world?

    View Results

    Loading ... Loading ...