How to scrape the data from website using CURL?

To scrap the data from website, Website must be public and open for scrapable. When scraping data from the website, i can be in different formats like json, html, xml etc. Most of the websites don’t allow direct scraping, they required user authentication. In the blow code, Just update the $url variable to which websites data you want to scrap.

Read More

What is htaccess? Why do we use this and where?

• htaccess files are configuration files of Apache Server that provide a way to make configuration changes on a per-directory basis. A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all subdirectories thereof. • These .htaccess files are used to change the functionality and features of Apache web server. For instance, htaccess file is used for url rewrite. • It is…

Read More

How can we increase the execution time of a PHP script?

• Default time allowed to execute for PHP scripts is 30 seconds mentioned in the php.ini file. The function used to set execution time is set_time_limit(int sec). If the value passed is ‘0’, it takes unlimited time. It should be noted that if the default timer is set to 30 sec, and 20 sec is specified in set_time_limit(), the script will run for 45 seconds. • This time can be increased by modifying the max_execution_time…

Read More

what is the use of rand() in php?

It is used to generate random numbers. If called without the arguments it returns a pseudo-random integer between 0 and getrandmax(). If you want a random number between 6 and 12 (inclusive), for example, use rand(6, 12).This function does not generate cryptographically safe values, and should not be used for cryptographic uses. If you want a cryptographically secure value, consider using openssl_random_pseudo_bytes() instead.

Read More

What is PEAR?

PEAR is a framework and distribution system for reusable PHP components. The project seeks to provide a structured library of code, maintain a system for distributing code and for managing code packages, and promote a standard coding style.PEAR is broken into three classes: PEAR Core Components, PEAR Packages, and PECL Packages. The Core Components include the base classes of PEAR and PEAR_Error, along with database, HTTP, logging, and e-mailing functions. The PEAR Packages include functionality…

Read More

What are the different types of errors in PHP ?

There are three basic types of run time errors in PHP: Notices: These are trivial, non-critical errors that PHP encounters while executing a script – for example, accessing a variable that has not yet been defined. By default, such errors are not displayed to the user at all – although you can change this default behavior. Warnings: These are more serious errors – for example, attempting to include() a file which does not exist. By…

Read More

What are the differences between mysql_fetch_array(), mysql_fetch_object(), mysql_fetch_row()?

Mysql_fetch_array Fetch a result row as an associative array, a numeric array, or both. mysql_fetch_object ( resource result ) Returns an object with properties that correspond to the fetched row and moves the internal data pointer ahead. Returns an object with properties that correspond to the fetched row, or FALSE if there are no more rows mysql_fetch_row() fetches one row of data from the result associated with the specified result identifier. The row is returned…

Read More

Differences between GET and POST methods

GET and POST are two different types of HTTP requests. GET:  GET is for retrieving data. It should have no side effects, you should be able to request the same URL over and over harmlessly. a) GET requests can be cached b) GET requests remain in the browser history c) GET requests can be bookmarked d) GET requests should never be used when dealing with sensitive data e) GET requests have length restrictions f) GET…

Read More
1 2