小编use*_*991的帖子

使用php curl将XML数据发送到webservice

我正在研究arzoo的Flight API.服务器必须在简单的POST请求中接收发布的数据.要实现这一点,我正在使用PHP cURL.在API文档中明确提到数据应按以下格式发送:

<AvailRequest>
        <Trip>ONE</Trip>
        <Origin>BOM</Origin>
        <Destination>NYC</Destination>
        <DepartDate>2013-09-15</DepartDate>
        <ReturnDate>2013-09-16</ReturnDate>
        <AdultPax>1</AdultPax>
        <ChildPax>0</ChildPax>
        <InfantPax>0</InfantPax>
        <Currency>INR</Currency>
        <Preferredclass>E</Preferredclass>
        <Eticket>true</Eticket>
        <Clientid>77752369</Clientid>
        <Clientpassword>*AB424E52FB5ASD23YN63A099A7B747A9BAF61F8E</Clientpassword>
        <Clienttype>ArzooINTLWS1.0</Clienttype>
        <PreferredAirline></PreferredAirline>
</AvailRequest>
Run Code Online (Sandbox Code Playgroud)

我已经在变量$ xml中使用了上面的代码.我的PHP cURL代码如下:

$URL = "http://59.162.33.102:9301/Avalability";

    //setting the curl parameters.
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL,$URL);
    curl_setopt($ch, CURLOPT_VERBOSE, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/xml'));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);

        if (curl_errno($ch)) 
    {
        // moving to display page to display curl errors
          echo curl_errno($ch) ;
          echo curl_error($ch);
    } 
    else 
    {
        //getting response from …
Run Code Online (Sandbox Code Playgroud)

php xml curl

24
推荐指数
2
解决办法
11万
查看次数

返回一行中包含NULL或0值的列

Table有10个领域.每个fieldcolumn包含Integer值.

现在我只需要返回具有Null0在结果集中的字段.

mysql sql null select

7
推荐指数
2
解决办法
2万
查看次数

标签 统计

curl ×1

mysql ×1

null ×1

php ×1

select ×1

sql ×1

xml ×1