Category : "Tutorial"

Php web development tutorials

Php – Do not rely on set_time_limit too much

Php set_time_limit Php has a function called set_time_limit which can be used to dynamically adjust the maximum execution time permitted to a script. It allows specifying the time in seconds and limits the script execution time to that many seconds. The set_time_limit function whenever called, effectively extends the script execution time by that many seconds. So if the script has already run ...

How to modify a SoapClient request in php

SOAP is a protocol to exchange objects over http. It is used to implement apis and the data being exchanged is in xml format. Sometimes it might be required to modify the soap request to add custom http headers for example. Since SoapClient is a class, it can be extended and the request process can be modified. Here is a ...

Socket programming with streams in php

Socket programming involves connecting to remote machines on LAN or over the internet using ip addresses and port number. For example google.com has an ip "173.194.36.3" and runs http server on port 80. So a socket application can connect to that ip address on that particular port number and start data communication. Socket extension Php comes with a socket extension which provide ...

Parse the user agent with ua-parser in php – detect browser, os and device

In your web application you might need to parse the user's user-agent string to find out the browser/OS/device being used. This is necessary specially when your webapp tries to adapt to the user's platform in a better way. For example a different layout for mobile device or restricted features/graceful degradation on a non supporting browser. To do this you can analyse ...

Convert html to pdf in php using mpdf

Html to pdf If your php application needs to generate some kind of pdf report then the simplest approach would be to generate the report as an html and then convert it to pdf using some library. Plenty of libraries are available that can convert html to pdf in php. To name a few - fpdf, tcpdf, mpdf etc. I found ...

How to use proxy with curl in php

Proxy with Curl Curl is a very useful library for transferring data over various protocols like http, ftp, https etc. In other words curl can be used to programatically download a web page, or upload file to ftp etc. It also supports using a proxy. This means that curl requests can go through a proxy server just like a web browser ...

Convert excel to csv in php

When working with data import and export for example, file formats like csv and excel are commonly used. Data can be exported to csv format and imported elsewhere. Also data might be entered manually in an excel file and then imported in the database. So there might be a need to convert excel files to csv format, so that they ...

Generate qrcode and pdf417 barcodes in php with tcpdf

Tcpdf is a pdf creation library for php that is written in pure php and works without the need of any external library. It also has the feature to generate 2d barcodes like qrcode and pdf417. The 2d barcodes can store much more information than the 2d ones like code39 and ISBN. It is recommended to generate barcodes inside pdf so ...

Php – Output content to browser in realtime without buffering

Consider a long running php script that does many tasks and after each task it outputs the status. echo 'Task 1 complete'; .... some delay ... echo 'Task 2 complete'; .... more delay and more tasks ... Now for such scripts it may be important to load the contents in browser as quickly as they are generated so that the user can understand the progress ...

Get the play time and bitrate of an mp3 in php

If your php application is processing media files like mp3, then it might need to find details of the mp3 file like its playtime, bitrate, encoder etc. There is a very useful php library called Getid3 that can extract information from mp3 files. Its written in pure php and does not have any dependencies. Needs php 5.0+. Get it here http://getid3.sourceforge.net/ Here is ...

Pages:123456»