Posts

Showing posts from October, 2012

create wsdl for sending email using soap and php

--------------------------create wsdl using my code simple php -------------------------------------------- <?php Author by bikash ranajn nayak require_once('../lib/nusoap.php'); $server = new nusoap_server; $server->configureWSDL('server', 'urn:server'); $server->wsdl->schemaTargetNamespace = 'urn:server';  $server->wsdl->addComplexType('Emailsend','complexType','struct','all','', array( 'To' => array('name' => 'ToEmailid','type' => 'xsd:int'), 'From' => array('name' => 'FromEmailid','type' => 'xsd:string'), 'Subject' => array('name' => 'Subject','type' => 'xsd:string'), 'Message' => array('name' => 'MessageBody','type' => 'xsd:string') )); $server->register('Emailsend',             array('

json return using soap server and soap client using php

copy soap_server page like (index.php); ----------------------------------------------------------------------- require_once('../lib/nusoap.php'); $server = new nusoap_server; $server->configureWSDL('server', 'urn:server'); $server->wsdl->schemaTargetNamespace = 'urn:server'; $server->register('getrequest',             array('name' => 'xsd:string'),                    array('return' => 'xsd:string'),             'urn:server',             'urn:server#getrequest'); function getrequest($value,$address) {    $getval=array('name'=>$value,'address'=>$address);       return json_encode($getval);      } $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA); ?> ------------------------------------------------------------------------------------ create soap client page (get json data form soap)ge

how to create nusoap_server and nusoap_client implemention using php

1st-> download nusoap class library  2nd->create wsdl function "getrequest()" using below code your WSDL url could be (http://127.0.0.1/test/nusoap/samples/index.php?wsdl) --------------------index.php-------------------------------------------- require_once('../lib/nusoap.php'); $server = new nusoap_server; $server->configureWSDL('server', 'urn:server'); $server->wsdl->schemaTargetNamespace = 'urn:server'; $server->register('getrequest',             array('value' => 'xsd:string'),             array('return' => 'xsd:string'),             'urn:server',             'urn:server#pollServer'); function getrequest($value){      if($value=="bikash"){      return "well come  bikash";      }else{        return "not bikash";      }      } $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTT

how to get post image from attached using id in wordpress

how to get post image in wordpress  how to  get attached id through post id in worpress $args = array(     'numberposts' => 1,     'order'=> 'DESC',     'post_mime_type' => 'image',     'post_parent' => $post->id ,     'post_type' => 'attachment'     ); $get_children_array = get_children($args,ARRAY_A);  //returns Array ( [$image_ID]... $rekeyed_array = array_values($get_children_array); $child_image = $rekeyed_array[0]; echo '<img src="'.wp_get_attachment_thumb_url($child_image['ID']).'" class="current">'; using post id get image form post data wordpress

point to currency convert from payal to customer using php

point convert to currency to  paypal using php $success = false; if($task == 'pay' && $point && $user_points > $point && $mail != '' && $point >= 1000) {     $environment = 'live';    // or 'beta-sandbox' or 'live'     function PPHttpPost($methodName_, $nvpStr_) {         global $environment, $setting;         $API_UserName = urlencode($setting['setting_paypal_api_user']);         $API_Password = urlencode($setting['setting_paypal_api_pass']);         $API_Signature = urlencode($setting['setting_paypal_api_sign']);         $API_Endpoint = "https://api-3t.paypal.com/nvp";         if("sandbox" === $environment || "beta-sandbox" === $environment) {             $API_Endpoint = "https://api-3t.$environment.paypal.com/nvp";         }         $version = urlencode('51.0');         $ch = curl_init();         curl_setopt($ch, CURLOPT_URL, $API_Endp

how to encode and decode html tag using php

how to encode and decode html tag using php you can encode using -> html_entities(mysql_real_escape_string($variable)); you can decoe using html_entity_decode(stripslashes($variable));

how to remove html tag in a string using php

<?php     $input = "<div id='bikash'><b>this is the html tag remove in php</b></div><strong>me use for html you do nt use</strong>";    echo  $b = strip_tags($input, "<strong><em>"); ?>

how to add new custom field virtuemart product category fields in joomla administrator

how to add new field from category virtuemart joomla execute query for add new category fields 1stp->    ALTER TABLE `jos_vm_category` ADD ` cat_wholesaler` VARCHAR( 1 ) NOT NULL DEFAULT 'N' AFTER `products_per_row` ; 2stp-> GO TO D:\xampp\htdocs\mil-bar\administrator\components\com_virtuemart\html\product.product_category_form.php open add your field in product.product_category_form.php       if ($db->sf("cat_wholesaler")=="Y")          {           echo "<input type=\"checkbox\" name=\"accesscat\" value=\"Y\" checked=\"checked\" />";          }else{           echo "<input type=\"checkbox\" name=\"accesscat\" value=\"Y\" />";          } 2stp->  administrator/components/com_virtuemart/classes/ps_product_category.php in (function add( &$d )) a. first get new field value for insert paste below code line 253       if (vmGet($d,'accesscat'

How to prevent mysql injection in Php before it is submitted

SQL injection refers to the act of someone inserting a MySQL statement to be run on your database without your knowledge. Injection usually occurs when you ask a user for input, like their name, and instead of a name they give you a MySQL statement that you will unknowingly run on your database.  This is the important bit, we take the $username and $password variables that we just filled with data, and we use the function mysql_real_escape_string on it, what this does is remove and characters that should not be in there, it actually does the same job as stripslashes() apart from this is the correct method used for MYSQL Databases. The rest of the code is pretty much self explanatory, after we have checked all the data and made it A-Z characters, we then perform the mysql query on the database and then we just check the returned information with a series of IF statement, these are all very self explanatory. This concludes this article, for more information on this subject, checkout

prime number using for loop in php

php using prime number program for($i=2;$i<50;$i++){ $counter=0; for($j=2;$j<$i;$j++){ if($i%$j==0){ $counter++; break; } } // you can check instead if($i==$j) if($counter==0){ echo $i.","; } }

what is main difference between php4 and php5

PHP5 introduces many new features, I have mentioned some of them: Unified Constructors and Destructors: In PHP4, constructors had same name as the class name. In PHP5, you have to name your constructors as  __construct() and  destructors as __destruct(). Abstract: In PHP5 you can declare a class as Abstract . Startic Methods and properties: Static methods and properties are also available. When you declare a class member as static, then you can access members using :: operator without  creating an instance of class. _autoload() PHP5 introduces a special function called __autoload() Final: PHP5 allows you to declare a class or method as Final  Magic Methods PHP5 introduces a number of magic methods. __call, __get, __set and __toString Visibility: In PHP5, There are 3 levels of visibilities:     Public : Methods are accessible to everyone including objects outside the classes.     Private : only available to the class itself.     Protected : accessible to the class itself and inherite

Difference between MySQL function and mysql procedure

      What are the differences between stored procedure and functions in mysql A FUNCTION is always returns a value using the return statement. A PROCEDURE may return one or more values through parameters or may not return at all. b. Functions are normally used for computations where as procedures are normally used for executing business logic. c . A Function returns 1 value only. Procedure can return multiple values (max 1024). d. Stored procedure returns always integer value by default zero. Whereas function returns type could be scalar or table or table values e. Stored procedure is precompiled execution plan where as functions are not. f. A function can call directly by SQL statement like select func_name from dual while procedure cannot. g. Stored procedure has the security and reduces the network traffic and also we can call stored procedure in any no. of applications at a time. h. A Function can be used in the SQL Queries while a procedure cannot be used in SQL queries .

difference between unset and unlink in php

unlink() is used to delete physical files...So lets say you have foo.txt somewhere on your server... unlink(foo.txt) would delete it. unset() is used to null out the value of a given variable. So for instance: x = 200; echo(x); // 200 unset(x); echo(x); // null The difference between the functions unlink and unset unlink() is a function for file system handling. It will simply delete the file in context. Example for unlink() : <?php $fh = fopen('test.html', 'a'); fwrite($fh, '<h1>Hello world!</h1>'); fclose($fh); unlink('test.html'); ?> unset() is a function for variable management. It will make a variable undefined. (or) Unset () is used to destroy a variable in PHP. In can be used to remove a single variable, multiple variables, or an element from an array. It is phrased as Unset ($remove). Also Known As: Unset Variable, Destroy Variable Example for unset() : <?php // remove a single variable unset($a); // remove a singl

retrive frineds list from facebook and post wall easlly

Image
  1stp-> create app for your website from facebook 2stp->download facebook library class file and put your connection  information 3rd-> call facebook class object and pass for friend list 4rth->get your friends list from facebook lastly you post wall to your friends wall

Fetchinng Facebook Friend List Running Example Using Javascript Sdk

Only replace your Api Id from YourApiIdHere and fetch friend information acording to requirement <%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html>   <head>     <base href="<%=basePath%>">         <title> 'FbFriends'</title>         <script src="http://connect.facebook.net/en_US/all.js"></script>         <script src="http://code.jquery.com/jquery-latest.js"></script>         <!--<link rel="stylesheet" type="text/css" href="styles.css">-->   </head>     <body>      <div id="fb-root"></div>

Post on Friend's Wall without Facebook Pop up using Javascript Sdk.

function PostOnFriendsWall() {         var access_token=document.getElementById("access_token").value;         var sendername=document.getElementById("sendername").value;         status1 = document.getElementById('message').value;         var facebookid = document.getElementsByName("facebookid");                       FB.api(         {             method: 'stream.publish',             message: status1,             target_id: facebookid,             access_token:access_token,             attachment: {             name: '' Your Message Here by'+sendername+' via Javascript Sdk .',             caption: ' Your Caption Here ',             description: (' Your Discription Here '),             href: ' Your URL Here where you want to redirect after click ',             media: [                     {                         type: ' image ',                         href: ' Your URL Here where you

Wall Post on Your Facebook Wall using Javascript Sdk

unction postOnSenderWallForMoneyGift() {     var FriendsName = document.getElementsByName("FriendsName");     var access_token=document.getElementById("access_token").value;               for (i = 0; i< FriendsName.length; i++)     {          recipient = FriendsName[i].value;         FB.api(         {             method: 'stream.publish',             access_token:access_token,             attachment: {             name: '' Your Message Here by'+sendername+' via Javascript Sdk .',             caption: ' Your Caption Here ',             description: (' Your Discription Here '),             href: ' Your URL Here where you want to redirect after click ',             media: [                     {                         type: ' image ',                         href: ' Your URL Here where you want to redirect after click ',                         src: ' Your Website Image Url if you want to displ

Calling Ajax Function in Struts Running Example

function AjaxFunction() {     var xmlHttp=GetXmlHttpObject();     if (xmlHttp==null)     {         alert ("Your browser does not support AJAX!");         return;     }     var url=" userwelcome.do?method=getContactById&contact_id="+cntId ;     xmlHttp.onreadystatechange=function()     {         if (xmlHttp.readyState==4)         {             var content=xmlHttp.responseText;             document.getElementById("Res_Div_ID").innerHTML=    xmlHttp.responseText;             document.getElementById("Div_ID").style.display        =    "none";             document.getElementById("Disp_Div_ID").style.display=    "none";         }     };     xmlHttp.open("POST",url,true);     xmlHttp.send(null); } function GetXmlHttpObject() {     var xmlHttp=null;     try     {         // Firefox, Opera 8.0+, Safari         xmlHttp=new XMLHttpRequest();     }catch (e)     {         // Internet Explorer         try         {