Get Latest Updated Data using SSE(Server-Sent-Events) Automatically

hii guys,

This is very interesting topic which i gonna share with you people.  So many times i think about how facebook/Twitter updates, stock price updates, news feeds, sport results are working?

finally i found easy and simple way to do same thing. so i just developed simple application which demonstrate usage of SSE (Sever-Sent-Events).

so i developed Latest Job Post Application, which give you latest job posted by any employee on webpage automatically.

let’s go for coding

index.html

index.php_SSE

so here i’m using SSE and in EventSource i’m passing viewpost.php file, which fetch latest record from table.

viewpost.php

viewpost.php_SSE

As a output in {topjob} div, always latest job will be printed without refreshing page.

About SSE:

A server-sent event is when a web page automatically gets updates from a server.

This was also possible before, but the web page would have to ask if any updates were available. With server-sent events, the updates come automatically.

Examples: Facebook/Twitter updates, stock price updates, news feeds, sport results, etc.

Disadvantage:

IE does not support it .. 😦

Done!

Hope you gonna like Dis. .. 🙂

Creating Excel file using PHP and downloading excel file

Hello guys,

I got easy way to create excel file using PHP and also it will download on client pc. so let’s go for coding.

Put this two lines in top of your PHP file.

header('Content-type: application/excel');
header('Content-Disposition: attachment; filename="sample.xls"');

Content Disposition header to supply a recommended filename and force the browser to display the save dialog.

now in html body part you can put any content which you want to fill it inside excel file.

Done!