473,800 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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($out put_column_form ats, $something else);
return(serializ e($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_WRITEFU NCTION 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 3831
On 13 Jan., 16:05, "C. (http://symcbean.blogsp ot.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_conten ts()
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
2717
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. If I do stick with background-images, do you think it matters where the rules are -- in an external stylesheet or inline rules, e.g.?
3
4839
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 the background of the td to be different for the currently selected linkbutton than for the other linkbuttons:
9
7212
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 variables back in the body of the email) and the image is on the server the mail is being generated from - have googled for ages on this one but can't seem to find anything suitable... Thanks for any help on this.
0
2058
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 possible to print MS Word and Excel docuements right from the ASP page. First I said sure I'll just link the document to the page then you can print it. That's not what they wanted, they wanted to be able to click on a link and have the server...
7
5131
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 ..navbar-background { background-image: url(images/menubar.gif); } the image is not appearing on the page. It seems that IE is picking
11
1856
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 intranet. I need to have pages be reloaded automatically when the data they reflect is changed at the server. For Netscape/Mozilla/Firefox, I do this by having the page use JavaScript to read a special "/update.html" URL in the background. For...
6
9679
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 the posting confirmation page to end displaying quickly, without waiting for those notifications or other tasks to complete. So basically what I want is to launch 'background.php' from 'main.php', with the user seeing only the output of - and...
0
5170
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 Data into Dataset if (criteria == "") { dsregional = new DataSet();
2
9818
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. And here a summary of what is the problem: I have a web application that has a web form into which I read data from a SQL database and load them in a ReportDocument of Crystal
0
10287
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10260
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10042
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6826
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5479
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5616
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4156
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3770
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2956
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.