You are here: background HTTP request « PHP Programming Language « IT news, forums, messages
background HTTP request

Posted by C. (http://symcbean.blogspot.com/) on 01/13/08 15:05

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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация