Friday, October 19, 2012

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($HTTP_RAW_POST_DATA);
------------------------------end nusoap server-------------------------------------------------------

3rd-> call  the wsdl what you create
-------------------------------------------------

create nusoapcallwsdl.php
past below my code


require_once('../lib/nusoap.php');
$client = new soapclient('http://127.0.0.1/test/nusoap/samples/index.php?wsdl');

$res=$client->__call('getrequest',array('bikash'));
print_r($res);

Wednesday, October 17, 2012

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