Showing posts with label Software Development. Show all posts
Showing posts with label Software Development. Show all posts

Tuesday 9 August 2016

What is RTMP, RTMPT, RTMPE, RTMPTE and RTMPS protocol?

What is  RTMP, RTMPT, RTMPE, RTMPTE and RTMPS protocol?

Question: What is RTMP?
The Real-Time Messaging Protocol (RTMP) is a streaming protocol designed by Adobe for transmission of audio, video between the flash player and server.


Question: What is RTMPT?
RTMPT is tunneled Version of RTMP.
RTMPT is designed to get rid of firewalls by sending stream packets through the standard web port.


Question: Which is better RTMP OR RTMPT?
RTMP performance is better that RTMPT.
We should use RTMPT only when RTMP is not possible due to firewalls.


Question: What is RTMPE?
RTMPE is encrypted version of RTMP.
Basically In RTMPE there is an additional security level as compare to RTMP.


Question: What is RTMPTE?
RTMPTE is encrypted version of RTMPT.
Basically In RTMPTE there is an additional security level as compare to RTMPT.


Question: What is RTMPS?
RTMPS is RTMP over a TLS/SSL connection.


Question: What is RTMFP?
Full form of RTMFP is  Secure Real-Time Media Flow Protocol. This protocol is developed by Adobe Systems for encrypted. It is efficient multimedia delivery through both client-server and peer-to-peer models over the Internet.


Question: Who uses the 1935 port by default?
RTMP and RTMPE with TCP Transport.
RTMFP with with UDP Transport.



Question: What are different ports used by Media Servers?
Following are different default ports used by Media Server.
Port Protocol Transport
1935 RTMP/E TCP
1935 RTMFP UDP
80 RTMP, RTMPT, HTTP TCP
8134 HTTP TCP
1111 HTTP, RTMP TCP

Question: What is TCP?
Full form of TCP is Transmission Control Protocol.
It is standard that defines how to establish and maintain a network conversation.
It can also work with IP (internet protocol), which define how to exchange packet of data with each other.
TCP keep maintained the connection til the programs finished their exchanging messages.


Question: What is UCP?
Full form of UDP is User Datagram Protocol.
UDP is communications protocol to TCP used primarily for establishing low-latency and loss tolerating connections between applications on the Internet.




Friday 8 April 2016

Apache Interview Questions And Answers for experienced

Apache Interview Questions And Answers for experienced

Question: How to set UTF-8 for data store and fetch?
  1. Specify the utf8mb4 character set on all tables and text columns in database.
  2. While getting data from database, set the utf8 character set, like below
    $dbh = new PDO('mysql:charset=utf8mb4');
  3. Add META tag in HTML, For Example:



Question: What is difference between HTTP_HOST and SERVER_NAME?
The SERVER_NAME is defined in server config.
The HTTP_HOST is obtained from the HTTP request header.
To view SERVER_NAME and HTTP_HOST in server, use below code.
echo 'Server Name: '.$_SERVER['SERVER_NAME']; echo "\n";
echo 'HTTP HOST: '.$_SERVER['HTTP_HOST'];



Question: Difference between the Apache HTTP Server and Apache Tomcat?
Apache is HTTP server application which parse the PHP and return HTML.
Apache Tomcat is servlet container which is used to deploy your Java Servlets and JSPs.


Question: How to enable mod_rewrite for Apache 2.2?
To use rewrite mode, use following
a2enmod rewrite

then please re-start the web server.
service apache2 restart



Question: Give few tips for debugging .htaccess rules?
  1. Use a Fake-user agent.
  2. Do not use 301 until you are done testing.
  3. Remember that 301s are aggressively cached in your browser.
  4. Use a HTTP Capture tool.
  5. Use below for htacess testing: http://htaccess.madewithlove.be/ http://htaccess.mwl.be/



Question: How to give 777 permission to a folder and all contents?
chmod -R 777 .



Question: Why WAMP showing 403 Forbidden message on Windows 7?
Wrong Virtual Host configuration
http://www.web-technology-experts-notes.in/2013/04/set-up-virtual-host.html


Question: How to change port number for apache in WAMP?
  1. Open httpd.conf file, in wamp server. Location in My Computer: E:\wamp\bin\apache\apache2.2.22\conf\httpd.conf
  2. Search "Listen 80" and replace the port number.
    Listen 80 
    to
    Listen 8080
  3. Re-Start your wamp Server



Question: What is thread safe or non thread safe in PHP?
A Thread Safe version should be used if you install PHP as an Apache module [Using WampServer/Xampp Server]. The Non Thread Safe version should be used if you install PHP as a CGI binary.


Question: Which PHP mode? Apache vs CGI vs FastCGI?
There are multiple ways to execute PHP scripts on a web server.
Following are three different way to execute the PHP.
  1. Apache:Using mod_php to execute PHP scripts on a web server. It is the most popular.
  2. CGI: Executing PHP scripts with a CGI application on a Web Server. It is the legacy way of running applications.
  3. FastCGI: FastCGI was in between the PHP Apache Module and the CGI application. It allows scripts to be executed by an interpreter outside of the web server.




Monday 28 March 2016

How to set P3P http header in PHP?

How to set P3P http header in PHP?

Question: How to set P3P In header with PHP?
header('P3P: CP="NOI ADM DEV COM NAV OUR STP"');



Question: What is header in php?
In Gernal terms, Header means head of body section.
In Web World, Every one can see the content of body and can't see header section easily.


Question: What is header function in php?
he header() function sends a raw HTTP header to a client. header() must be called before any actual output is sent.


Question: What is P3P?
Full form of P3P is Platform for Privacy Preferences.
The P3P is a protocol allowing websites to declare their intended use of information they collect.


Question: What are main content for P3P?
  1. What kind of information is collected like email, password and ip address etc From browser.
  2. How you are using this information.
  3. How long information is stored in Browser



Question: What is file format of P3P?
File Name: p3p.xml
File Format:

  <policy-references>
    <expiry max-age="10000000"><!-- about four months -->
  </expiry></policy-references>



Question: What are benefits of P3P?
P3P allows browsers to understand their privacy policies in a simplified and organized manner.


Question: What is Third Party content in Web?
When we include iframe in any webpage, content of iframe is "third party content".


Question: When P3P is born?
2002


Question: What is the most broad P3P header that will work with IE?
CON, TEL, PHY, ONL, FIN, GOV
CON: Information may be used to contact the individual for the promotion of a product or service.
TEL: Information may be used to contact the individual via a voice telephone call for promotion of a product or service.
PHY: Information that allows an individual to be contacted by telephone OR Address.
ONL: This information is independent of the specific computer used to access the network.


Question: Which browser is consider P3P?
Internet Explorer


Question: Why cookie is disabled for Iframe In website in IE Browser?
Because IE does not fully trust on Iframe content, He consider it third party content.


Thursday 3 March 2016

Dojo Interview Questions and Answers for Fresher

Dojo Interview Questions and Answers for Freshers

Question: What is Dojo?
It is JavaScript framework used for rapid development of cross-platform applications and web sites. Also known as Dojo Toolkit.


Question: What is current Stable release of Dojo?
1.10.4 / January 18, 2015


Question: In Which language, Its written?
JavaScript


Question: What is offical website of dojo?
http://dojotoolkit.org


Question: From where I can download dojo?
http://dojotoolkit.org/download/


Question: How to load dojo from CDN?
<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js"></script>



Question: Is it opensource??
Yes, It is.


Question: What are different section/parts of Dojo library?
  1. dojo: Its core files.
  2. dijit: It have user-interface modules for widgets and layout
  3. dojox: It have assorted module
  4. util: It have tools like optimization, documentation, style-checking and testing.



Question: What are different Advantages of Dojo?
  1. Associative arrays
  2. Objects and classes
  3. Regular expression
  4. Loosely typed variables



Question: What are different Features of Dojo?
  1. Widgets
  2. Asynchronous communication
  3. Packaging system
  4. Client-side data storage
  5. Server-side data storage



Question: What is the basic structure in Dojo?
/index.html - The application entry point.
/app - The application module.
/app/main.js - The main script for app module.


Question: What is Widget Toolkit in Dojo?
Widget is a user interface object that has a layout and HTML+CSS bound by JavaScript. Dojo have widgets like Tabs, sorting table and dialogs etc.


Question: How to use Dojo Editor widget?
<script>
dojo.require("dojo.widget.textEditorId");
</script>
<textarea dojotype="textEditorId"> </textarea>



Question: Give some dojo components name?
  1. DOJO Tree
  2. DOJO Button
  3. DOJO Grid
  4. DOJO List box
  5. DOJO Calendar



Question: What is difference between DOJO and jQuery?
DOJO jQuery
JavaScript toolkit or framework JavaScript library
HTML and JavaScript based tool kit supports almost all web languages
Dojo requires higher network bandwidth Works good in low network bandwidth
Good for bigger website and application Good for small application.



Thursday 25 February 2016

SSRS Interview Questions and Answers for Beginners

SSRS Interview Questions and Answers for Beginners

Question: What is SSRS?
SQL Server Reporting Service(SSRS) is a server-based report generation software systems from Microsoft.


Question: Why SSRS is used?
  1. Generate variety of reports.
  2. Admin use web based interface for generate the report.
  3. You can create very rich reports (Tabular / Matrix / Graphical/Interactive)
  4. Export in variaous format like Excel, PDF, word etc.
  5. It is faster and cheaper.
  6. Efficient reporting
  7. Security integrated


Question: Explain the Reporting Life Cycle of SSRS?
  1. Development of Reports: Design the reports by Developer.
  2. DBA Analyse: DBA check the security and schedule the time for generating the report.
  3. Report Delivery: After generating the report DBA check the list and handover to appropriate person.



Question: What are the Reporting Services components?
  1. Report Designer: Design the report.
  2. Report Sever: Execute the Report.
  3. Report Manager



Question: Difference between SQL Server Reporting Services and Crystal Reports?
SQL Server Reporting Services Crystal Reports
SSRS have a report server Processed by IIS
SSRS is available for Report history snapshots. Caching is available through cache server.
Custom Label NOT available. Custom Label are available


Question: What are different types of roles provided by SSRS?
  1. Browsers
  2. Content Manager
  3. My Reports
  4. Publishers
  5. Report Builder


Question: What are the three different part of RDL file?
  1. Data
  2. Design
  3. Preview



Question: What is RDL?
RDL is a file extension for an XML file used in SSRS.
MIME type: text/xml


Question: What are the different types of data sources in SSRS?
  1. Microsoft SQL Server
  2. OLEDB
  3. Oracle
  4. ODBC
  5. SQL Server Analysis Service
  6. XML
  7. Teradata
  8. Hyperion
  9. SAP Net weaver BI
  10. Report Server Model



Question: In Which format we can export SSRS Reports?
  1. HTML
  2. Excel
  3. PDF
  4. Tiff Image
  5. XML
  6. CSV



Question: What is report snapshot?
It is instance of a report for future reference and its save in server.


Question: What is Tabular Report in SSRS?
Simply display the data using table.
Tabular report is the simplest Report of the SSRS Report.


Question: What is a Matrix in SSRS?
Matrix allows us to create crosstab reports with the variables on rows and columns.


Question:What is Query parameter in SSRS?
SQL Qery can be accepted as parameters.Query parameters begin with the symbol i.e @.


Question: What is the chart in report?
Chart reports are for graphical representation of reports. pie charts and 3D chart are also available.


Question: What are data regions?
Data regions are report items that display repeated rows of summarized information from datasets.


Question: What is Report Builder?
Report Builder is a report authoring environment for business users.


Question: What are alternatives of SSRS at free of cost?
  1. Jasper Reports
  2. JFreeReport
  3. Pentaho
  4. Business Intelligence Reporting Tools
  5. DataVision



Question: What are the Types of SSRS?
  1. Parameterized reports
  2. Ad hoc reports
  3. Clickthrough reports
  4. Drillthrough reports
  5. Subreports
  6. Linked reports
  7. Snapshot reports
  8. Cached reports



Question: What is Data Set in report?
It is set of data which we want to show in report.


Question: What is the report model project?
It is used to create Adhoc reporting.


Question: What is RS.exe utility?
It is used for deploying the report on report server.


Wednesday 24 February 2016

Google App Engine Free Hosting

Google App Engine

Question: What is Google App Engine?
Google App Engine is a platform as a service (PaaS).
It provides cloud computing platform for developing and hosting web applications in Google-managed data centers.
It is also know as GAE.


Question: When comes stable version of Google App Engine?
1.9.26 / 4 September 2015


Question: Which Programming languages support by GAE ?
Python, Java, Go, PHP and coming others

Question: What is Offical website for GAE?
http://cloud.google.com/appengine


Question: Why GAE is used?
It is used to develop the Web Application, APIs for Mobile, Web Application.


Question: What are different built-in services available?
  1. NoSQL datastores
  2. memcache
  3. user authentication API


Question: What are benefits of using GAI
  1. Load Balancing
  2. Health Checks
  3. Application logging
  4. Automatic Scaling
  5. Automated Security Scanning


Question: What are different IDE available with GAE
Eclipse, IntelliJ, Maven, Git, Jenkins, and PyCharm.


Question: Is it free?
Yes, It is free upto few Level.
Check here for details https://cloud.google.com/appengine/


Question: What is Difference between Google Apps and Google App engine(GAE) ?
Google Apps: It is Web-based hosted software-as-a-service (SaaS).
For Example: gmail.com, Gtalk, Google calender

Google App engine: It is a platform-as-a-service (PaaS).
Here you can host your Website and Website APps.
For Example: It is similar to Amazon Elastic Compute Cloud (EC2).


Question: What are the steps to start with Google App Engine?
  1. Download the App Engine SDK for PHP
  2. Creating a Simple Request Handler
  3. Create the Configuration File
  4. Testing the Application
  5. Iterative Development
  6. Uploading the application
  7. Done
For Details : https://cloud.google.com/appengine/docs/php/



Question: How to start the PHP development in Google Engine App?
  1. Registering an app on GAE. https://appengine.google.com/
  2. Download the Google App Engine from https://cloud.google.com/appengine/downloads#Google_App_Engine_SDK_for_PHP
  3. Starting a project with IDE
  4. create main.php and app.yaml files
  5. Test your application
  6. Upload to Server

http://www.sitepoint.com/google-app-engine-php-getting-started/
for PHP, You have to install Python 2.7 Version From https://www.python.org/downloads/release/python-2711/


Question: Where can i check my PHP Code?
http://localhost:8080/



Friday 12 February 2016

PHP HTML5 video streaming examples

PHP HTML5 video streaming examples

Today, HTML5 video player is being popular. It stream with a given video, If you need to control the streaming from your server script to provide additional facility like ACL/Auth, resume support, sending small videos etc. You can do all with PHP.
Following are PlayVideoStream class, Which you can use
class PlayVideoStream
{
    /** set the private data members **/
    private $path = "";
    private $stream = "";
    private $buffer = 1024000;
    private $start  = -1;
    private $end    = -1;
    private $size   = 0;
    /** set the private data members **/
    
    /** Set the video file path in while creating the object **/
     function __construct($filePath) 
    {
        $this->path = $filePath;
    }
     
    /**
     * Open the file in read mode
     */
    private function open()
    {
        if (!($this->stream = fopen($this->path, 'rb'))) {
            die('Not able to read the file i.e '.$this->path);
        }
         
    }
     
    /**
     * Set  header to serve the video play
     * Here we are getting the mime type dynamically, for this you must enable php_fileinfo extension
     */
    private function setHeader()
    {
        ob_get_clean();
        $result = new finfo();
        $videoType= $result->file($this->path, FILEINFO_MIME_TYPE);  //Get the correct video type
        header("Content-Type: ".$videoType);
        header("Cache-Control: max-age=2592000, public");
        header("Expires: ".gmdate('D, d M Y H:i:s', time()+2592000) . ' GMT');
        header("Last-Modified: ".gmdate('D, d M Y H:i:s', @filemtime($this->path)) . ' GMT' );
        $this->start = 0;
        $this->size  = filesize($this->path);
        $this->end   = $this->size - 1;
        header("Accept-Ranges: 0-".$this->end);
         
        if (isset($_SERVER['HTTP_RANGE'])) {
  
            $c_start = $this->start;
            $c_end = $this->end;
 
            list(, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2);
            if (strpos($range, ',') !== false) {
                header('HTTP/1.1 416 Requested Range Not Satisfiable');
                header("Content-Range: bytes $this->start-$this->end/$this->size");
                exit;
            }
            if ($range == '-') {
                $c_start = $this->size - substr($range, 1);
            }else{
                $range = explode('-', $range);
                $c_start = $range[0];
                 
                $c_end = (isset($range[1]) && is_numeric($range[1])) ? $range[1] : $c_end;
            }
            $c_end = ($c_end > $this->end) ? $this->end : $c_end;
            if ($c_start > $c_end || $c_start > $this->size - 1 || $c_end >= $this->size) {
                header('HTTP/1.1 416 Requested Range Not valid');
                header("Content-Range: bytes $this->start-$this->end/$this->size");
                exit;
            }
            $this->start = $c_start;
            $this->end = $c_end;
            $length = $this->end - $this->start + 1;
            fseek($this->stream, $this->start);
            header('HTTP/1.1 206 Partial Content');
            header("Content-Length: ".$length);
            header("Content-Range: bytes $this->start-$this->end/".$this->size);
        }
        else
        {
            header("Content-Length: ".$this->size);
        }  
         
    }
    
    /**
     * close curretly opened stream
     */
    private function end()
    {
        fclose($this->stream);        die;
    }
     
    /**
     * perform the streaming of calculated range
     */
    private function stream()
    {
        $i = $this->start;
        set_time_limit(0);
        while(!feof($this->stream) && $i <= $this->end) {
            $bytesToRead = $this->buffer;
            if(($i+$bytesToRead) > $this->end) {
                $bytesToRead = $this->end - $i + 1;
            }
            $data = fread($this->stream, $bytesToRead);
            echo $data;
            flush();
            $i += $bytesToRead;
        }
    }
     
    /**
     * Start streaming video content
     */
    function start()
    {
        $this->open();
        $this->setHeader();
        $this->stream();
        $this->end();
    }
}



Question: How to play video with above class?
$filePath='c://wamp/www/project/public_html/videos/myvideoFile.mp4';
//$filePath='c://wamp/www/project/public_html/videos/myvideoFile1.mp3';
//$filePath='c://wamp/www/project/public_html/videos/myvideoFile2.mp4';
//$filePath='c://wamp/www/project/public_html/videos/myvideoFile3.3gp';
$stream = new PlayVideoStream($filePath);
$stream->start();


Saturday 26 December 2015

What is Composer in php? - Manage the Dependencies

What is Composer in php? -  Manage the Dependencies


Question: What is Composer?
Composer is an application-level package manager for the PHP.


Question: Why Composer is used?
  1. Composer provides a standard format for managing dependencies of PHP software.
  2. Composer installs the dependencies libraries.
  3. Composer provides autoload capabilities for libraries.


Question: Where composer is used?
When we need manage the dependencies of PHP application, we can use Composer.


Question: How Composer Works?
It works commond line.


Question: Who developed the Composer?
  1. Nils Adermann.
  2. Jordi Boggiano.
.

Question: What is current stable version of Composer?
1.2.0 / July 18, 2016.


Question: In Which language, It was writeen?
PHP.


Question: What is offical website of Composer?
http://getcomposer.org/


Question: What are System Requirements for compser?
  1. PHP 5.3.2+
  2. Need git, svn or hg repository depend of composer version.


Question: What is command to download the composer?
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
You need curl OR openssl enable for above command.


Question: How to install the composer?
php composer.phar install



Question: How to update the composer?
php composer.phar update



Question: How to check current version of composer?
php composer.phar -V



Question: Can I used composer standard for my new project?
Yes, you can start.


Question: Is it open-source?
Yes, It is open-source.


Question: Give me sample of composer.json file?
{
    "name": "zendframework/skeleton-application",
    "description": "Skeleton Application for ZF2",
    "license": "BSD-3-Clause",
    "keywords": [
        "framework",
        "zf2"
    ],
    "homepage": "http://framework.zend.com/",
    "require": {
        "php": ">=5.3.3",
        "zendframework/zendframework": "2.3.2"
    }
}

Friday 11 December 2015

Hadoop Basic Interview Questions and Answer

Hadoop Basic Interview Questions and Answer



Question: Name fews companies that use Hadoop?
  1. Facebook
  2. Amazon
  3. Twitter
  4. eBay
  5. Adobe
  6. Netflix
  7. Hulu
  8. Rubikloud



Question: Differentiate between Structured and Unstructured data?
Data which are proper categorized and easily search and update is know as Structured data.
Data which are proper un-categorized and can't search and update easily is know as Un-Structured data.


Question: On Which concept the Hadoop framework works?
HDFS: Hadoop Distributed File System is the java based file system for scalable and reliable storage of large datasets. Data in HDFS is stored in the form of blocks and it operates on the Master Slave Architecture.
Hadoop MapReduce:MapReduce distributes the workload into various tasks which runs in parallel. Hadoop jobs perform 2 separate job. The map job breaks down the data sets into key-value pairs or tuples. The reduce job then takes the output of the map job & combines the data tuples in smaller set of tuples. The job is performed after the map job is executed.


Question: What is Hadoop streaming?
Hadoop distribution has a generic programming interface for writing the code in any programming language like PHP, Python, Perl, Ruby etc is know as Hadoop Streaming.


Question: What is block and block scanner in HDFS?
Block: The minimum amount of data that can be read or written is know as "block" (Defualt 64MB).
Block Scanner tracks the list of blocks present on a DataNode and verifies them to find any type of checksum errors.


Question: What is commodity hardware?
Hadoop have thousands of commodity hardware which are inexpensive that do not have high availability. these are used to execute to job.


Can we write MapReduce in other than JAVA Language?
Yes, you can write MapReduce task in other languages like PHP, Perl etc.


Question: What are the primary phases of a Reducer?
  1. Shuffle
  2. Sort
  3. Reduce


Question: What is Big Data?
Big data is too heavy database that exceeds the processing capacity of traditional database systems.


Question: What is NoSQL?
It is non-relational un-structured database.


Question: What problems can Hadoop solve?
It sove following problems.
  1. When database too heavy and exceed its limit.
  2. Reduce the cost of server.



Question:Name the modes in which Hadoop can run?
Hadoop can be run in one of three modes:
  1. Standalone (or local) mode
  2. Pseudo-distributed mode
  3. Fully distributed mode



Question:What is the full form of HDFS?
Hadoop Distributed File System

Question:What is DataNode and Namenode in Hadoop?
Namenode is the node which stores the filesystem metadata.
File maps with block locations are stored in datanode.


Question:What are the Hadoop configuration files?
  1. hdfs-site.xml
  2. core-site.xml
  3. mapred-site.xml



Tuesday 20 October 2015

Manage SPF Record - How to add SPF Record?

Manage SPF Record - How to add Spf Record?


Question: What is SPF Record?
An SPF record is a type of DNS record that identifies which mail servers are permitted to send email on behalf of your domain. Full form of DNS is Domain Name Service.


Question: What is purpose of SPF Record?
It identifies which mail servers are permitted to send email on behalf of your domain. In this way, It help us to prevent from spammer email.

Question: How to add SPF record?
You manage SPF Record, you must need have access DNS Manager.


Question: How to add SPF Record in Godaddy.com?
https://www.mail-tester.com/spf/godaddy

IF you are using other than Godaddy then check your "Web hosting company"
https://www.mail-tester.com/spf/

Question: Can we add two domain in SPF Record?
Yes, you can add two OR more domain in SPF Record.


Question: Can we add Two SPF Record
No, you can't add two OR more SPF Record.
Multiple SPF records will cause the SPF evaluation to fail with "permerror" (see RFC 7208, Section 4.5.).
But you can add multiple domain in Single SPF Record.


Question: How to add multiple domain in Single SPF Domain?
Single Domain in single SPF Record
v=spf1 include:spf.protection.outlook.com -all

Two Domain in single SPF Record
v=spf1 include:spf.protection.outlook.com include:spf.mandrillapp.com -all

Three Domain in single SPF Record
v=spf1 include:spf.protection.outlook.com include:spf.mandrillapp.com include:spf.domain.com  -all

Question: How to check SPF Record is available OR Not?
Make sure there is NO Error.


Question: How to Remove "support@mail128-15.atl41.mandrillapp.com" In Email's from?
To remove this text, you need to add SPF & DKIM Record in your DNS.
https://mandrill.zendesk.com/hc/en-us/articles/205582277-How-do-I-add-DNS-records-for-my-sending-domains-

Tuesday 18 August 2015

How do you parse and process HTML in PHP

How do you parse and process HTML in PHP


Following are different ways to parse the HTML

Use DOM: The DOM extension allows you to operate on XML documents through the DOM API with PHP 5.
$fullHTML = file_get_contents('http://www.example.com/scrap.php');
$domObj = new DOMDocument();
$domObj-&gt;loadHTML($fullHTML);
$xpath = new DOMXPath($domObj);
$tags = $xpath-&gt;query('//div[@class="myclass"]/div');
foreach ($tags as $tag) {
    print_r(trim($tag-&gt;nodeValue));
    echo "\n";
}



Use SimpleXMLElement: The SimpleXML extension provides a very simple and easily usable toolset to convert XML to an object that can be processed with normal property selectors and array iterators.
$fullHTML = file_get_contents('http://www.example.com/scrap.php');
$allData = new SimpleXMLElement($fullHTML);
print_r($allData);



Regular Expressions: It is sequence of symbols and characters expressing a string or pattern to be searched for within a longer piece of text.
$fullHTML = file_get_contents('http://www.example.com/scrap.php');
preg_match_all("/&lt;(\w+)(\s+(\w+)\s*\=\s*(\'|")(.*?)\\4\s*)*\s*(\/&gt;|&gt;)/", $fullHTML, $matches);
print_r($matches);



3rd Party Libraries
There are lot of 3 party libraries which can parse your HTML/XHTMl. Following are few famous libraries.
phpQuery: phpQuery is a server-side, chainable, CSS3 selector driven Document Object Model (DOM) API based on jQuery JavaScript Library written in PHP5 and provides additional Command Line Interface (CLI).
Zend_Dom: Zend_Dom provides tools for working with DOM documents and structures.
QueryPath: QueryPath is a PHP library for manipulating XML and HTML.
FluentDom: FluentDOM provides a jQuery-like fluent XML interface for the DOMDocument in PHP.



WebServices
There are different APIs are available for the scraping the website and few of them are following.
YQL:The YQL Web Service enables applications to query, filter, and combine data from different sources across the Internet. It have like SQL syntax, familiar to any developer with database experience.
ScraperWiki: ScraperWiki's external interface allows you to extract data in the form you want for use on the web or in your own applications. You can also extract information about the state of any scraper.