douhuiyan2772 2014-01-29 11:00
浏览 40

PHP中的数组(使用SOAP)

I am trying to output the contents of a web service using SOAP and PHP.

This is the code I have at present:

<?php
    $params = array('Criteria' => array( // create "Criteria" array
    'SearchType' => 'sales',
    'MinPrice'=>400000,
    'MinBeds'=>2,
    'MinBaths'=>1,
    'ShowSold' =>true,
    'sortBy'=>'bedrooms',
    'SortDescending'=>true,
    'Limit'=>10,
        'PropertyField'=>array('ID','Image','Address1','Address2','Postcode','PriceString')
    ));
    ?>
    <?php
    // Call the web service function and pass the parameters setup above.
    $featured_properties = $client->call('GetSalesProperties',$params, $ns);
    echo '<div class="results-list">'; 
        foreach ($featured_properties as $featured) {
            echo '<article class="property">' . $featured . '</article>';
        }
    echo '</div>';
    print_r($featured);
    ?>

I have added the require_once to initialise the web service and used print_r just to see what should be output. Ideally, I would like the elements in the array to be wrapped in their own tags and each record to be in a containing article.

At the moment, I'm getting Array as my echoed content.

My PHP is basic and SOAP is something new so I need help please.

  • 写回答

2条回答 默认 最新

  • dongzhi6382 2014-01-29 12:09
    关注

    you can follow this format for call to add article as root tag,

            $featured_propertiest = $client->call('GetSalesProperties', array('article' => $params));
    

    And have you declared soap client?

    require_once('lib/nusoap.php');
    $client = new nusoap_client('wsdl_link', true);
    
    评论

报告相同问题?

悬赏问题

  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理