PHP CURL on Proxy Server

How to use CURL with Proxy

This post will be demonstrating how to use curl with proxy in PHP and Linux command line. What is additional parameter we need to pass while using curl via proxy. So I am starting with proxy configuration in PHP curl. 1) PHP curl with proxy $url = ‘http://localhost/path/to/file.php’; $proxy = ‘127.0.0.2:3128’; $ch = curl_init(); curl_setopt($ch,…

Read More
$this vs self in PHP

$this vs self in PHP

$this refers to the current object of the class and self refers to the current class itself.$this can not be used inside static function whereas self can be used inside static function. When we need to access static function and reference static member variable then we can’t access through $this because a property declared as…

Read More
Merge array recursively in PHP

Merge array recursively in PHP

If you want merge array recursively in php then you can use array_merge_recursive function. It will merge all the array elements having same string keys and it returns the resulting array. Syntax: Note :- Values in the input array with numeric keys will be renumbered with incrementing keys starting from zero in the result array….

Read More
New features in PHP 5.6

New features in PHP 5.6

Here is list of New features in PHP 5.6 1) Variadic functions via …2) Argument unpacking via …3) Changes in File uploads4) Importing namespace functions5) Exponentiation Operator in PHP (**) 1) Variadic functions via … Currently variadic functions are implemented by fetching the function arguments using func_get_args() . If we want to pass random number…

Read More
getting started with FuelPHP

Getting Started with FuelPHP

Getting Started with FuelPHP FuelPHP is a simple, flexible, community driven PHP 5 web framework. It was born out of the frustrations people have with the current available frameworks and developed with support from a community of developers. FuelPHP is extremely portable, works on almost any server and prides itself on clean syntax. Installations:- Follow…

Read More
Count matching occurrences in php array

Count matching occurrences in php array

You can Count matching occurrences in php array using php array function array_count_values() Syntax: array array_count_values ( array $array ) array_count_values() returns an array using the values of array as keys and their frequency in array as values.  Example:-   <?php       $array = array(1,”roopendra”,1,”php”,”roopendra”);       print_r(array_count_values($array));   ?> Above code will output:

Read More
validate url in php

Validate URL in PHP

You can validate URL in PHP using regular expression or using validate filters Validate URL in PHP using regular expression: Example:- Validate URL using validate filters: Example:- Validate URL using validate filters with flag value: Flags:- FILTER_FLAG_PATH_REQUIRED  : Requires URL to have a path in URL the domain name (like www.example.com/Orders/order/) FILTER_FLAG_QUERY_REQUIRED : Requires URL…

Read More
Verified by MonsterInsights