473,396 Members | 1,989 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

background HTTP request

Hi all,

I'm dabbling with an Ajax datagrid control and am looking to see if I
can make it a bit more sophisticated.

I've got a PHP script, let's call it page.php which renders a page
with a fancy dhtml table (http://dhtmlx.com/docs/products/dhtmlxGrid/
index.shtml) this connects to another script which provides the XML
datafeed to populate the table, lets call it xmlfeed.php

Despite what it says in the docs, I can't convince the grid to load
its configuration from XML (from xmlfeed.php). The alternate approach
is to configure the table using Javascript which I can generate and
output from within page.php.

So far so good.

But rather than have all the meta-data about the table (column names,
data-types etc) in page.php, I would rather push this down to
xmlfeed.php so I can use the same page.php for different data feeds.
Not a problem....I just setup xmlfeed.php to respond with the meta-
data when started with a particular parameter - eg

<?php

if ($_GET['returnMetaData']=='Y') {
// page.php is asking how the table should be configured...
$out=array($output_column_formats, $something else);
return(serialize($out));
} else {
// fetch the data and construct AJAX response...
mysql_connect(...
}
?>

So far, so good. Certainly it would be neater to just include
xmlfeed.php within page.php rather than going out through HTTP, but
that definitely would not allow for the next step....

Because of the way page.php is structured, I can request the metadata
a long time (in the life of page.php) before I need to use the data.
which begs the question, can I have the request running in the
background?

I see the PHP curl library has an option CURLOPT_WRITEFUNCTION to
specify a callback when data is available from the request - does
setting this automatically make the request asynchronous or do I need
to do something else?

(note that starting a shell and invoking a seperate process to fetch
the page and write to a file is expected to be too much of an
overhead).

TIA

C.
Jan 13 '08 #1
1 3804
On 13 Jan., 16:05, "C. (http://symcbean.blogspot.com/)"
<colin.mckin...@gmail.comwrote:
I've got a PHP script, let's call it page.php which renders a page
with a fancy dhtml table (http://dhtmlx.com/docs/products/dhtmlxGrid/
index.shtml) this connects to another script which provides the XML
datafeed to populate the table, lets call it xmlfeed.php
What exactly are you trying to do?

In case you'd like to perform an asynchronous XMLHTTPRequest, I'd
propose
xAjax, since this makes requesting data very simple: Register a PHP
function
with xAjax and call it from within your JS, as if it would be a JS
function:
See here: http://xajaxproject.org/

I wonder, if an asynchronous HTTP request makes any sense in PHP.
Since PHP does not
provide some kind of an event model. Using asychronous CURL calls,
which trigger
a callback, might be risky, since these calls might corrupt PHPs stack
frames etc.

In case URL wrappers are enabled, you might simply wish to use
file_get_contents()
and pass an URL to get the contents of the URL sychnronously.
See here: http://de3.php.net/file_get_contents
Jan 13 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Manatee | last post by:
Hi group. I had been setting background-images for some page elements, which seemed to load absolutely last, and I was wondering if the pics would appear earlier/faster if I used IMG tags instead....
3
by: Gil | last post by:
Hello, I use VB.NET and have a series of linkbuttons that are inside individual <td>s. Like this: <td background="image.gif"><asp:linkbutton id="myID" runat="server"/></td> I would like...
9
by: | last post by:
Hi - is it possible to set an image as the background body image (non-repeating too) in a message sent using CDO. I don't want to embed an external webpage (I have to insert user form related...
0
by: Lee Harris | last post by:
Hello, I have a client that has about 150 users on a intranet that I've created. The server is Windows 2000 with IIS 5.0 and has Office 2000 installed. The client came to me and asked if it was...
7
by: Nilesh | last post by:
I am using background-image attribute in a CSS file and linking the CSS file to aspx page. But strangly, background-image attribute is not working for relative URL. e.g. If I apply following css...
11
by: Steve Kirkendall | last post by:
I need a work-around for an IE limitation, regarding fetching HTTP documents in the background. It takes a bit of explaining; please be patient... I'm working on an project that will run on an...
6
by: Francois Bonzon | last post by:
Any idea how I can launch a background task from a PHP script? For example, when a user posts on my message board, it may fire many e-mail notifications to other users, and other tasks. I want...
0
by: Kalpesh | last post by:
Hi All, I am using .net crystal reports to develop the reports. The version of crystal report assemblies is 10.2.3600.0. When i run the reports i got following error. #region Retry Report...
2
by: patrice.pare | last post by:
Hello, Here is a summary of my Dev Environment: I use Visual Studio 2005 Team Suite SP1 with Crystal Report XI SP1 on a Windows XP SP2 development workstation. I also use SQL Server 2000 SP4. ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.