note 57602 deleted from ref.curl by felipe
| From: | felipe@php.net | Date: | Sun, 30 Mar 2008 19:07:30 +0000 |
| Subject: | note 57602 deleted from ref.curl by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-137770@lists.php.net to get a copy of this message | ||
Note Submitter: expert at yahoo dot com
----
For more features using JavaScript XML HTTP Request Object components (AJAX), visit this page : http://expert.no-ip.org/?ajax
example.php
===========
<?php
require_once 'Ajax.php';
// add headers
$addheader[] = array("TEST1", "test one");
$addheader[] = array("TEST2", "test two");
// javascript code by http status
$cmd[] = array("alert({ajax})", 200);
$cmd[] = array("alert('Error 404 - File not found !')", 404);
$cmd[] = array("alert('HTTP Status '+{stat}+' !')",
"DEFSTAT");
$obj = new Ajax;
// get test.php body source using method GET
$obj->request("test.php");
// set additional header information
$obj->headers($addheader);
?>
<html>
<head>
<?=$obj->head();?>
</head>
<body>
<?=$obj->get($cmd);?>
Example.php
</body>
</html>
test.php
========
<?php
// print header information HTTP_TEST1 & HTTP_TEST2
echo "HTTP_TEST1: ".$_SERVER['HTTP_TEST1']."\n".
"HTTP_TEST2: ".$_SERVER['HTTP_TEST2'];
?>