Chat with us, powered by LiveChat

php

How to send POST/GET requests/data via PHP

How to send POST/GET requests/data via PHP

PHP 4.3.0 saw the introduction of the Streams API, which provides a consistent set of methods for reading and writing data to and from any specific location. Whenever you use file_get_contents() or another filesystem function, you are actually using the Streams API, albeit transparently in the background. A “stream” is simply a resource object which …

What is XML? How is it different to HTML?

What is XML? How is it different to HTML?

XML is short for Extensible Markup Language, and exists to easily transfer data from one location to another, as well as store it. Less experienced web developers tend to get confused over XML because in plain sight, it isn’t extremely clear what XML is and just what it is used for – when it really …

How to send mail using SMTP in PHP

How to send mail using SMTP in PHP

You have two primary choices that you can use: SwiftMailer library or the PHP Extension and Application Repository (PEAR). To use SwiftMailer, here is an example (although their documentation describes in more detail the individual methods, etc.) $transport = Swift_SmtpTransport::newInstance(‘mail.example.com’, 587); // your mail server address and port. If you don’t know what yours is, …

Regular Expressions: What are they and how do I use them? (PHP)

Regular Expressions: What are they and how do I use them? (PHP)

Regular expressions provides an easy and precise way of matching certain patterns within a string. There can indeed be very complex regular expressions that can be written, or very simple ones. For example, a very simple regular expression could be (for PHP, specifically): $regex = preg_match(“/^hello$/”,$string); In this example, the word hello is required completely because of …