Monday, 20 January 2014

Web Services using PHP

Creating Web Service Using PHP Within 10 Minutes

Thanks for share. Ref;

What is SOAP?

SOAP is based on XML so it is considered human read. It is a protocol for accessing a Web Service. It is a simple XML-based protocol to let applications exchange information over HTTP.

Why SOAP?

In real field, so many applications are required for data communication between systems by Remote Procedure Calls (RPC) between objects like DCOM and CORBA but HTTP was not designed for this.
  • RPC represents compatibility
  • Security problem
  • Firewalls and proxy servers will normally block this kind of traffic.
A better way to communicate between applications is over HTTP as HTTP is supported by all Internet browsers and servers. That's why it is preferable to SOAP Service.
We can collaborate with other programmers building big size and complex applications in multiple platforms.

What is SOAP?

SOAP is based on XML so it is considered human read. It is a protocol for accessing a Web Service. It is a simple XML-based protocol to let applications exchange information over HTTP.

Why SOAP?

In real field, so many applications are required for data communication between systems by Remote Procedure Calls (RPC) between objects like DCOM and CORBA but HTTP was not designed for this.
  • RPC represents compatibility
  • Security problem
  • Firewalls and proxy servers will normally block this kind of traffic.
A better way to communicate between applications is over HTTP as HTTP is supported by all Internet browsers and servers. That's why it is preferable to SOAP Service.
We can collaborate with other programmers building big size and complex applications in multiple platforms.
Here, I will create a web service using PHP code. So let’s follow the steps given below:
Step 1: You will download the library from http://sourceforge.net/projects/nusoap/.
Step 2: Run WAMP server, then you will go to www root folder location.
Step 3: Create folder, it’s called “WebServiceSOAP” into www root folder.
Step 4: Paste "lib" folder inside your "www/WebServiceSOAP/" location from Step 1 download files.
Step 5: Create two files “server.php” and “client.php” into WebServiceSOAP folder location.
Step 6: Inside “server.php”, please write the code lines given below:
<?php
//call library 
require_once ('lib/nusoap.php'); 
//using soap_server to create server object 
$server = new soap_server; 

//register a function that works on server 
$server->register('get_message'); 

// create the function 
function get_message($your_name) 
{ 
if(!$your_name){ 
return new soap_fault('Client','','Put Your Name!'); 
} 
$result = "Welcome to ".$your_name .". Thanks for Your First Web Service Using PHP with SOAP"; 
return $result; 
} 
// create HTTP listener 
$server->service($HTTP_RAW_POST_DATA); 
exit(); 
?>  
Step 7: After creating “server.php” file, now we will test this server function. Please go to URL & typehttp://localhost/WebServiceSOAP/server.php?wsdl.
Step 8: Create "client.php" file into WebServiceSOAP folder location. Please find the following code lines:
<?php 
require_once ('lib/nusoap.php'); 
//Give it value at parameter 
$param = array( 'your_name' => 'Monotosh Roy'); 
//Create object that referer a web services 
$client = new soapclient('http://localhost/WebServiceSOAP/server.php'); 
//Call a function at server and send parameters too 
$response = $client->call('get_message',$param); 
//Process result 
if($client->fault) 
{ 
echo "FAULT: <p>Code: (".$client->faultcode."</p>"; 
echo "String: ".$client->faultstring; 
} 
else 
{ 
echo $response; 
} 
?> 
Step 9: Save all codes, then please go to URL and type http://localhost/WebServiceSOAP/client.php.
Result: Welcome to Monotosh Roy. Thanks for Your First Web Service Using PHP with SOAP
So, today I have shown you how to use simple SOAP web service and to get message from service at client end.
Hope this post will help you to create a simple web service using SOAP. Post your queries if you have any or if there is anything else, please share. Keep visiting for new posts here.
Have a good day!

Friday, 17 January 2014

BlackBerry WebWorksSet up links

Chart implementation in Web Sites


Open source HighCharts

http://www.highcharts.com/demo/column-drilldown

 Download link: 13.5 MB size  http://www.highcharts.com/download

It can support RWD. mobile -webkit- working


Thanks for Ref :Mr. JDK

6 Ways to Encrypt Password and urlencode ,decode in PHP

PHP Encrypt Password and Display URL of current page and URI details

<?php
echo hash_hmac('ripemd160', 'Stay foolish, stay hungry.', 'secret');
echo '<br>';

echo hash('ripemd160', 'Stay foolish, stay hungry.');
echo '<br>';

echo sha1('tobbynews');
echo '<br>';

echo md5('tobbynews');
echo '<br>+12r---';

echo crc32('Stay foolish, stay hungry.');
echo '<br>';

echo crypt('Stay foolish, stay hungry.');
echo '<br>';

echo $_SERVER['PHP_SELF'];echo '<br>';
echo $_SERVER['SCRIPT_NAME'];echo '<br>';
echo $_SERVER['HTTP_HOST'];echo '<br>';
echo $_SERVER['SERVER_NAME'];echo '<br>';
echo $_SERVER['REQUEST_URI'];echo '<br>';


$encode=base64_encode ('ganpath');echo $encode;echo '<br>';
$decode=base64_decode($encode);echo $decode;echo '<br>';
$rot13=str_rot13('ganpath');echo $rot13;echo '<br/>';//Perform the rot13 transform on a string

//echo date ( string $format [, int $timestamp = time() ] );
echo urlencode ( 'http://192.168.1.36:9090/eg/' );echo '<br/>';


?>

The out put is :
---------------
d96e9683178a9d6defedde594f7e1944cf8864b6
2f86cf7076249485b549ffc137ab644cb9c9e67a
bbb6cc2fc4f0d1cc7d230032d8bca24adc73837c
6288a589247f3ab3231fc9a86e624ac8
1875988720
$1$cC2./v0.$mlRkbA5CoBNT9WrkAo0Zj0
/eg/encrypt/encrypt.php
/eg/encrypt/encrypt.php
192.168.1.36:9090
192.168.1.36
/eg/encrypt/encrypt.php
ganpath
tnacngu
https%3A%2F%2F192.168.1.36%3A9090%2Feg%2F

Thanks for Ref : http://tobbynews.com/6-ways-to-encrypt-password-in-php.html

Monday, 13 January 2014

jQuery Plugin will disable text selection for Android and iOS devices

<script>
$(document).ready(function(){

   $('.notselectable').disableSelection();
    
});
// This jQuery Plugin will disable text selection for Android and iOS devices.

$.fn.extend({
    disableSelection: function() {
        this.each(function() {
            this.onselectstart = function() {
                return false;
            };
            this.unselectable = "on";
            $(this).css('-moz-user-select', 'none');
            $(this).css('-webkit-user-select', 'none');
        });
    }
});
</script>
Thanks for Ref: // Stackoverflow Answer: http://stackoverflow.com/a/2723677/1195891

Friday, 10 January 2014

NetBeans PHP Debugging with WAMP

PHP and NetBeans Debug process Working.
Edit(add the lines) into php.ini file like this.

; XDEBUG Extension
zend_extension = "c:/wamp/bin/php/php5.4.16/zend_ext/php_xdebug-2.2.3-5.4-vc9.dll"
[xdebug]
xdebug.remote_enable = on
xdebug.profiler_enable = on
xdebug.remote_handler=dbgp
xdebug.idekey="netbeans-xdebug"
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"

Prevoiusly it was in this format.
---------------------------------
; XDEBUG Extension

zend_extension = "c:/wamp/bin/php/php5.4.16/zend_ext/php_xdebug-2.2.3-5.4-vc9.dll"

[xdebug]
xdebug.remote_enable = off
xdebug.profiler_enable = off

xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"

-------------------------------------------------
Once complete these steps restart Netbeans and Wamp server.

Debug : stop Debug whole Netbeans project.
Create project make Errored PHP file.

right click and debug ,press F5 after that line move cursor on line. It show Debugging.
-------------------------------------------------------
Thanks for Ref:
http://stackoverflow.com/questions/13028768/netbeans-not-connecting-with-xdebug-on-wamp-showing-waiting-for-connection#comment17685664_13028768


PHP - Debugging using XDebug

PHP Debugging using xdebug

Thanks for Ref: http://xdebug.org/docs/install  http://xdebug.org/docs/install

About XDebug 

XDebug is an opensource Debugger and Profiler for PHP. PDT has built in support for Xdebug, which allows you to step-debug through your PHP projects.

Setup


Installation

The first step is to install XDebug and verify that XDebug is running. See the Installation section of the XDebug manual for how to obtain the extension.
To setup XDebug as your default debugger in PDT, simply configure the Default Settings in the Debug eclipse preference page of PHP
Debug Settings.png

Configuration

The most important setting for xdebug to work with PDT is xdebug.remote_enable = 1. Typically you set this value in your php.ini. To verify that XDebug
is loaded by your server, use the phpinfo() method and check if you can find an XDebug configuration section.
PHP INI1.png PHP INI2.png

PHP Eclipse PDT plugin for debugging

Eclipse 3.6 / Helios / PDT 2.2

Note: PDT 2.2 is scheduled for release in June 2010. This will install a recent development snapshot, not the final 2.2.0 release.

From Update Site

Prerequisites

  • Installed and running Eclipse Classic 3.6

Installation Flow

  • Open Help->Install New Software.
  • Select the Helios update site and choose Eclipse PDT . When the list of existing features is populated - select 'Runtime' feature:
Helios site.PNG
  • Proceed with the installation by pressing 'Next', then press 'Next' again in the next screen.
  • Accept the EULA when asked:
PDT 2 2 Accept EULA.png
  • Finish the installation. Restart Eclipse.
  • After restarting switch to the PHP perspective, and you are done:
PDT 2 2 Switch Perspective.png

From Zips

  • Download the latest PDT 2.2 Runtime + all its listed build dependencies, including Eclipse.
  • Unpack Eclipse, then unpack everything else into your eclipse/dropins/ folder.
  • Run the Eclipse executable file.

Thursday, 9 January 2014

Online Project with Source Code in PHP,JAVA,Android,C#,etc...

Yii Eclipse PDT plugin for Yii Framework

Installation

To add yiiclipse to your PDT installation use one the following update site:
Update Site (STABLE): http://yiiclipse.maziarz.org/updatesite/STABLE/

Update Site (DEVELOPMENT): http://yiiclipse.maziarz.org/updatesite/DEV/

Adding yii framework support to existing PHP project

Just open context menu on your project and choose Configure > Toggle Yii support
After successfully switching on yii support you should see yii logo decoration on right-top corner of you project’s icon.

Installation step by step

Yiiclipse is Eclipse plugin and is installed via Update Site mechanism. In order to add new update site one need to go to “Install New Software” under “Help” top menu item (as shown below)
Than press “Add” button and put “Yiiclipse” as Name, and “http://yiiclipse.maziarz.org/updatesite/1.0″ as Location. After accepting below form should appear.
After selecting Yiiclipse whole tree and press finish button all other required plugins should be installed automatically.

Installation details for Aptana users

As Aptana does not use PHP Development Tools under the hood there is not possible to install Yiiclipse without installing previously PDT. PDT in turn requires DLTK to be installed.
The following steps must be taken to install PDT:
  • Go to Help -> Install new software.. and click “Available software sites”. Than activate “Eclipse Update Site”, add PDT update site (http://download.eclipse.org/tools/pdt/updates/release)
  • First from the Eclipse Update Site install “Dynamic Languages Toolkit Core Frameworks”
  • After that from the PDT Update Site install “PHP Development Tools (PDT) Runtime Feature”
  • Now you can install Yiiclipse

Wamp Myadmin/ MySql Password Configuration

Change MySQL root password in WAMP 

serverThe MySQL console

Open MySQL console from WAMP menu. Wamp MySQL Console
Alternatively you can launch ‘MySQL’ from command prompt.
C:\wamp\bin\mysql\mysql5.1.36\bin>mysql
Setting a password for root user
The WAMP bundle does not have a password for the root user by default. You can login right away by hitting the <Enter> key (refer image below).
mysql console from cmd prompt
At the “mysql>” cmd prompt, enter the following line, and press ENTER.
SET PASSWORD FOR root@localhost=PASSWORD('Enter Your Password here');
Note: Replace your password in the place ‘Enter Your Password here’ and make sure you have typed inside the quotes.
A successful password change will look like this.
MySQL password change window
Now, you have changed the password for MySQL’s root user. But phpMyAdmin will attempt to connect to MySQL using NO password (as configured in config.inc.php), throwing an error as shown below.
Error 1045 - Access denied for user 'root'@'localhost' (using password NO)
To update the mysql password set in phpMyAdmin’s configuration:
  1. Browse to WampServer phpmyadmin folder, for ex: Installed drive:\Wamp\apps\phpmyadmin3.5.1
  2. Open the config.inc.php file using Notepad or Wordpad. The file should look like this:
    config.inc
  3. Replace the empty quotes with the password that you have set for the MySQL and change the ‘AllowNoPassword’ value to false. For ex.
    MySQL password variable
  4. Save the file and you are done. Now go back to browser and press ” Ctrl + F5 “.
Update password for root user
To update the password at a later stage, use the following command in MySQL console.
mysql> UPDATE mysql.user SET Password=PASSWORD('Your new Password') WHERE User='root';
And do not forget to update your new password in phpMyAdmin’s config file.
Thanks for Ref share

Redux vs Redux Toolkit vs React Context

  These are often confused. Feature Redux Redux Toolkit Context API Purpose State management Simplifies Redux Shares values in Rea...