HTTP Request Methods-PHP



HTTP Request Methods The Internet’s HTTP protocol, commonly used to fetch Web pages, defines a number of “methods” that browsers can use to send requests and data to Web servers. Of the available methods, the two most important are the GET method and the POST method.
GET is the “default” method for the Internet, used whenever you request a page with your browser. All data in the request must be encoded in the URL.

POST is most often used for submitting forms. It allows additional form data to be sent with the request. HTML lets you specify the method to use for each formtag. Although GET is the default, it is most common to use POST, which avoids cluttering the URL with the submitted data.


Use the POST method when declaring your form in HTML. This prevents
form values from appearing in the URL, and allows a larger amount of data
to be submitted through the form.

Use PHP’s htmlspecialcharsfunction when populating form fields with
PHP values, to avoid malformed HTML.
PHP has its own wrappers for Curl, so we can use the same tool from within
PHP. A simple GETrequest looks like this:
<?php
$url = "http://oreilly.com";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);

?>
The previous example is the simplest form, setting the URL, making a request to its
location (by default this is a  GET  request), and capturing the output. Notice the use of
curl_setopt(); this function is used to set many different options on Curl handles and
it has excellent and comprehensive documentation on http://php.net. In this example,
it is used to set the  CURLOPT_RETURNTRANSFERoption to  true, which causes Curl to  return
the results of the HTTP request rather than  outputthem. In most cases, this option
should be used to capture the response rather than letting PHP echo it as it happens.
We can use this extension to make all kinds of HTTP requests, including sending custom
headers, sending body data, and using different verbs to make our request.
If you use normal HTTP, form data will be sent in “clear text” over the Internet
from the browser to the server. This means it can be intercepted by someone
using a packet sniffer. When you send confidential information such as financial details,
 use an encryption technology such as SSL.

<?php
$url = "http://requestb.in/example";
$data = array("name" => "Lorna", "email" => "lorna@example.com");
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER,
array('Content-Type: application/json')
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);

?>
Again,  curl_setopt()is used to control the various aspects of the request we send.
Here, a POSTrequest is made by setting the CURLOPT_POSToption to 1, and passing the
data we want to send as an array to the  CURLOPT_POSTFIELDSoption. We also set a
Content-Typeheader, which indicates to the server what format the body data is in; the
various headers

Assuming magic quotes is disabled on your server, and you have no other measures
in place to prevent it, this clever attack alters the meaning of the query:
SELECT * FROM users
WHERE username='' AND password='' OR username LIKE '%'

The modified query will select allrecords in the user table! When the script checks
whether any users matched the supplied user name and password combination,
it will see this big result set and grant access to the site

This can be prevented if we escape the incoming variables:

$sql = "SELECT * FROM users
WHERE username='" . safeEscapeString($_POST['username']). "'
AND password='" . safeEscapeString($_POST['password']). "'";
In some cases, depending on the circumstances, this may not be necessary.

Advantages of MySQL and PHP

Certain technologies play together better than others. PHP, a simple and powerful scripting language, and MySQL, a solid and reliable database server, make a perfect marriage between two modern technologies for building databasedriven, dynamic Web sites. Some of the advantages of both PHP and MySQL are:
•  High performance
•  Built-in libraries
•  Extensibility
•  Relatively low cost
•  Portability
•  Developer community
•  Ease of learning
High Performance
PHP is no longer considered just a grassroots scripting language, but now with PHP 5, and its highly efficient built-in Zend engine, PHP accommodates developers and IT decision makers in the business trend to rapidly release and update software on the Web faster than conventional programming cycles have allowed.
MySQL, a highly optimized database server, provides the response time and throughput to meet the most demanding applications.With PHP scripts connected to a MySQL database, millions of pages can be served on a single inexpensive server.
Built-In Libraries
PHP comes with many built-in functions addressing common Web development tasks. Problems encountered by other programmers have been solved and packaged into a library of routines, made available to the PHP community. The official PHP Web site at http://www.php.netprovides excellent documentation explaining how to use all of the functions currently available.
Extensibility
PHP and MySQL are both extensible, meaning that developers around the world are contributing add-on modules to extend the functionality and power of the languages to stay current with the growing market needs and standards of the day. You can also obtain the source code for both PHP and MySQL. Source code is the code that a program consists of before theprogram is compiled; that is, the original building instructions of a program.
Relatively Low Cost
As a Web developer you can demand a lot more money for your time if you can master PHP and MySQL. Because they are open source projects, there is no licensefee associated with using PHP or MySQL. Because both applications run on almost any platform, you also have a wide range of hardware choices lowering the total cost of ownership. With so many qualified PHP developers sharing information on the Web, and excellent online documentation, you can get the most up-to-date, reliable information without paying for it.
Portability
PHP and MySQL run on almost any platform, including Linux, Windows, Mac OS X, FreeBSD, Solaris, and so on. If well written, you can simply copy the code from one server to another and expect the same results, perhaps with some minor adjustments.
Developer Community
Both PHP and MySQL have a huge following in the development community. If you run into a problem, you can usually very quickly find support on the Web, where your problem can be posted, identified, and resolved by other users and developers sharing your problem. Developers worldwide are constantly finding and resolving bugs and security holes, while working to keep these languagesup-to-date and optimized.
Ease of Learning
PHP and MySQL are relatively easy to learn. Most of the PHP constructs are similar to other languages, specifically Perl, making it familiar to most developers. MySQL uses the SQL query language and English-like language used by most modern database management systems today. If you have had any experience with SQL, you will find using it with MySQL an easy transition.

MySQL is a relational database management system. Whether you’re involved with a Web site that processes millions of requests a day like eBay or Yahoo!, or a smaller site such as your own online shop or training course, the data must be stored in an organized and structured way for easy access and processing.
This is handled by a database management system such as MySQL where the data is stored in tables rather than in a flat file.

MySQL uses the client/server model; that is, a database server (MySQL) that serves (communicates) with multiple clients application programs), where the clients may or may not be on the same computer. It also supports SQL, the structured query language, a standardized language used by most modern databases for working with data and administering the database.

MySQL software is open source. As discussed earlierin this chapter, open source means that it is possible for anyone to download MySQL from the Internet, and use and modify the software without paying anything. The MySQL software uses the GPL GNU General Public License, http://www.fsf.org/licenses/, to define what you may and may not do with the software in different situations. If you need to use MySQL code in a commercial application, you can buy a commercially licensed version. See the MySQL Licensing Overview for more information http://www.mysql.com/company/legal/licensing .
The MySQL Database Server is very fast, reliable, and easy to use. MySQL Server was originally developed to handle large databases much faster than existing solutions and has been successfully used in highly demanding production environments for several years. Its connectivity, speed, and security make MySQL Server highly suited for accessing databases on the Internet.

MySQL serves as a back end for all kinds of information such as e-mail, Web images and content, games, log files, and so on. The server can be embedded in applications such as cell phones, electronic devices, public kiosks, and more.

configuring PHP-impact security

The primary mechanism for configuring PHP is the php.inifile.
As the master file, this provides you with control over all configuration settings.
Entries generally take the format:
setting= value

Be sure to read the comments provided in the file before making changes, though.
There are a few tricks, such as include_pathusing a colon (:) as a seperator on
Unix, and a semicolon (;) on Windows.
Most Web hosts will not provide you access to your php.inifile unless you have
root access to the system (which is typically not the case if you’re using a cheap
virtual hosting service). Your next alternative is to use .htaccessfiles to configure
PHP assuming the Web server is Apache.
An .htaccessfile is a plain text file that you place in a public Web directory to
determine the behavior of Apache when it comes to serving pages from that directory; for instance, you might identify which pages you’ll allow public access to.
Note that the effect of an .htaccessfile is recursive—it applies to subdirectories
as well.

To configure PHP with .htaccessfiles, your hosting provider must have the
Apache setting AllowOverride Optionsor AllowOverride Allapplied to your
Web directory in Apache’s main httpd.confconfiguration file. Assuming that
is done, there are two Apache directives you can use to modify PHP’s configuration:
php_flag
used for settings that have boolean values (i.e. on/offor 1/0) such as
register_globals

php_value
used to specify a string value for settings, such as you might have with the
include_pathsetting
Here’s an example .htaccessfile:

# Switch off register globals
php_flag register_globals off
# Set the include path
php_value include_path ".;/home/username/pear"

The final mechanism controlling PHP’s configuration is the group of functions
ini_setand ini_alter, which let you modify configuration settings, as well as
ini_get, which allows you to check configuration settings, and ini_restore,
which resets PHP’s configuration to the default value as defined by php.iniand
any .htaccessfiles. Using ini_set, here’s an example which allows us to avoid
having to define our host, user name and password when connecting to MySQL:
ini_set('mysql.default_host', 'localhost');
ini_set('mysql.default_user', 'harryf');
ini_set('mysql.default_password', 'secret');
if (!mysql_connect()) {
echo mysql_error();
} else {
echo 'Success';
}

Be aware that PHP provides for some settings, such as error_reporting, alternative functions that perform effectively the same job as ini_set.

Apple seeds iOS 8 beta

Apple is now seeding the iOS 8 beta 2 to developers. It comes exactly two weeks after the Beta 1 went live and brings lots of bug fixes and a few new features.

 Some of the critical fixes include a working brightness slider, purchases are sorted again by date in the App Store, and crashes does not occur when adding third party keyboards.

There are numerous fixes done on the HealthKit and Handoff feature between iOS 8 Beta 2 and Yosemite Beta 2. Apple's QuickType keyboard premieres on iPads, too.

Finally, the Apple's Podcast app comes pre-installed with iOS 8 Beta 2, as it was
with the iBooks app in Beta 1. New settings are available in the iOS 8 Beta 2 - Battery
 Usage Per App, Disable All Notifications, Enable iCloud Photos for sharing.


There are lots of ways you can install iOS 8 Betas. There are reports for some errors upon installing iOS 8 Beta 2, so if you don't know what you are doing or you are afraid to loose precious data - you should probably wait for the official release this fall. Side by side with the iOS 8 Beta 2

Medical Jobs At East Delhi Municipal Corporation

Online applications are invited for the following posts of Doctors in East Delhi Municipal Corporation
  1. Specialist-Surgery : 05 posts
  2. Specialist Gynecology : 07 posts
  3. Specialist Pediatrics : 07 posts
  4. Specialist –Medicine : 03 posts
  5. Specialist Ophthalmology : 02 posts
  6. Specialist Pathology : 04 posts
  7. Specialist Anesthetist : 05 posts
  8. Specialist ENT : 05 posts
  9. Specialist Radiologist : 05 posts
  10. Specialist Orthopedics : 04 posts
  11. General Duty Medical Officer - II : 25 posts
  12. Specialist-Microbiology : 01 post
  13. Specialist-Biochemistry : 01 post
  14. Specialist Dermatology : 03 posts
  15. Specialist MEDICAL MICROBIOLOGY : 01 post
  16. Specialist RESPIRATORY MEDICINE AND TB : 02 posts
How to Apply :  Apply Online at MCD East website on or before 30/06/2014 only. 
For more information and online submission of application form,
 View Details
 http://111.93.49.24/recruitment/control/portalView

Teacher job at South Delhi Municipal Corporation


Online Applications are invited from desirous candidates, who fulfill the eligibility conditions of the post concerned, for engagement as Teachers on contract basis :

  1. Teacher (Primary) : 800 posts
  2. Teacher (Nursery) : 120 posts
  3. Special Educator (Primary) : 588 posts
  4. Counsellors : 24 posts
How to Apply :  Apply Online at South Delhi Municipal Corporation (SDMC) website  on or before 30/06/2014.
For more information and online submission of application form
View Details:http://111.93.49.24/recruitment/control/portalView

How Search Engines Work

Virtually all search engines operate in a similar fashion. Each search engine has robots
that keep visiting the web pages and keep indexing what they find there. The process
takes place in the following order:

Web crawling
Indexing
Searching
This is done by an automated web browsing script known as web crawlers, which are
popularly known as spiders. They retrieve information from the HTML coding of a web
page and they keep visiting the links present on that site and also find one way links
leading to the web page or website and continue indexing this data.
Data about web pages are indexed in a database for use in providing quick search
results. A search query can be a single word or a phrase depending on the
requirements of the person using the search engine. The function of this index is to
quickly enable a searcher to find the relevant information.

Social Networking And  SEO

However, social networking has challenged SEO in new ways because of the fact that
you no longer needed to impress only Google, but ordinary people. This meant that you
were no longer able to simply rely upon getting your stuff ranked highly by the Google
search engine but instead were forced to try to appeal to ordinary people

Google's dominance is also a bit of the Microsoft Office effect. Microsoft's Office
suite is considered the standard bearer in the world of office suites and they have
worked hard to maintain that dominance. Thus everyone else works to try to be
compatible with Microsoft Office which in turn makes Microsoft Office more entrenched.
Similarly, because nobody can afford to ignore Google as they work on SEO, people
tend to focus on Google as they do their SEO, which in turn feeds on Google.
How to get your website to top of google .

Google is so much more popular than all the rest is that they
have been working to keep themselves on top. This means that they make constant
updates to their algorithms in order to try to stay ahead of the spammers and black hat
SEO people. They have also worked to make their brand name ubiquitous

XML Sitemap

The premise of using XML Sitemap Protocol was that it would help search engines
index  content  faster  while  providing  ways  to  improve  their  existing  crawling  algorithms. Using XML Sitemap Protocol does not guarantee anything in terms of better
page rankings. Furthermore, use of XML Sitemap Protocol is not mandatory for all
sites. In other words, a website will not be penalized if it is not using XML Sitemaps.

SERPs

Once the visitor clicks on the Search button, things start to get more interesting. First,
the visitor is telling the search engine what he is looking for. The search engine responds
with a results page based on the current index for the specific region the visitor is coming
from. Between the time that the results page shows up and the time the visitor clicks
on a specific search result, many things can be recorded, including:
• The time it took to click on the first result not necessarily the first SERP result.
• The time it took to click on other results if any.
• Whether the visitor clicked on subsequent SERPs
• Which result in the SERPs the visitor clicked on first, second, and so on
• The time between clicks on several results.
• The CTR for a specific result.

Differences between Major Search Engines

All search engines basically perform the same task of providing relevant info which is
being searched for by the users. The only difference is how they index the information.
Search engines such as Google store all or part of the source as well as information
about the web pages which is present as the page source. On the other hand, some
search engines store every word they find on a web page.
Top 10 backlinking sources .

The main feature that marks a difference among search engines is their indexing
methods and search criteria. Some search engines index all the words and make that
the basis of their search results, while others establish relevance of terms by conducting
proximity searches. Presently Google has the largest share of the search engine
market. This is due to its popularity and the set of algorithms that it keeps updating to
make the user experience more relevant.

Google Analytics

Although Google Analytics is great at many things it does, it is far from perfect. You
can accomplish everything Google Analytics does and more with old-fashioned web
server logs and a solid third-party analytics tool. Web server logs do not lie or report
inaccurate data.
Google Analytics does have its benefits, as it is almost live and can be accessed from
anywhere. With Google’s integration of Analytics with its other flagship platforms.
If you have to use dynamic content, yet you need to ensure proper search engine crawling

Best Of Arijit Singh Songs

Best Of Arijit Singh Songs

Ek Villain: Galliyan Full Audio Song

Ek Villain: Galliyan Full Audio Song

Jeene Laga Hoon Bollywood-song

Jeene Laga Hoon Bollywood-song