douhua1890 2016-04-05 23:30
浏览 49
已采纳

使用EHttpClient Yii的出站efax开发人员api请求不起作用

I'm using EHttpClient extension yii. My Code:

$file = file_get_contents($path, true);

Yii::import('ext.EHttpClient.*');

$client = new EHttpClient('https://secure.efaxdeveloper.com/EFax_WebFax.serv', array(
    'maxredirects' => 3,
    'timeout'      => 30,
    'Content-Type' => 'application/x-www-form-urlencoded',
    'adapter'      => 'EHttpClientAdapterCurl'));

$client->setParameterPost(array('id'=>urlencode("2313125942"), 'xml'=>urlencode($file)));


SiteHelper::printShow($client);

$response = $client->request("POST");

var_dump($response->isSuccessful());
SiteHelper::printShow($response);

My xml data:

<?xml version="1.0"?>
<OutboundRequest>
    <AccessControl>
        <UserName>b23s2323</UserName>
        <Password>b23s2323</Password>
    </AccessControl>
    <Transmission>

        <TransmissionControl>
            <Resolution>STANDARD</Resolution>
        </TransmissionControl>

        <DispositionControl>
            <DispositionLevel>BOTH</DispositionLevel>
            <DispositionEmails>
                <DispositionEmail>
                    <DispositionAddress>johnmorris201615@gmail.com</DispositionAddress>
                </DispositionEmail>
            </DispositionEmails>
        </DispositionControl>

        <Recipients>
            <Recipient>
                <RecipientFax>8189790412</RecipientFax>
            </Recipient>
        </Recipients>

        <Files>
            <File>
                <FileContents>Base64 pdf here</FileContents>
                <FileType>pdf</FileType>
            </File>
        </Files>

    </Transmission>
</OutboundRequest>

The information of my request:

EHttpClient Object
(
    [config:protected] => Array
        (
            [maxredirects] => 3
            [strictredirects] => 
            [useragent] => EHttpClient
            [timeout] => 30
            [adapter] => EHttpClientAdapterCurl
            [httpversion] => 1.1
            [keepalive] => 
            [storeresponse] => 1
            [strict] => 1
            [output_stream] => 
            [encodecookies] => 1
            [rfc3986_strict] => 
            [content-type] => application/x-www-form-urlencoded
        )

    [adapter:protected] => 
    [uri:protected] => EUriHttp Object
        (
            [_username:protected] => 
            [_password:protected] => 
            [_host:protected] => secure.efaxdeveloper.com
            [_port:protected] => 443
            [_path:protected] => /EFax_WebFax.serv
            [_query:protected] => 
            [_fragment:protected] => 
            [_regex:protected] => Array
                (
                    [alphanum] => [^\W_]
                    [escaped] => (?:%[\da-fA-F]{2})
                    [mark] => [-_.!~*'()\[\]]
                    [reserved] => [;\/?:@&=+$,]
                    [unreserved] => (?:[^\W_]|[-_.!~*'()\[\]])
                    [segment] => (?:(?:(?:[^\W_]|[-_.!~*'()\[\]])|(?:%[\da-fA-F]{2})|[:@&=+$,;])*)
                    [path] => (?:\/(?:(?:(?:[^\W_]|[-_.!~*'()\[\]])|(?:%[\da-fA-F]{2})|[:@&=+$,;])*)?)+
                    [uric] => (?:[;\/?:@&=+$,]|(?:[^\W_]|[-_.!~*'()\[\]])|(?:%[\da-fA-F]{2}))
                )

            [_scheme:protected] => https
        )

    [headers:protected] => Array
        (
        )

    [method:protected] => GET
    [paramsGet:protected] => Array
        (
        )

    [paramsPost:protected] => Array
        (
            [id] => 2313125942
            [xml] => The%encoded%url%xml%data
        )

    [cookiejar:protected] => 
    [last_request:protected] => 
    [last_response:protected] => 
    [redirectCounter:protected] => 0
    [_unmaskStatus:protected] => 
    [_queryBracketsEscaped:protected] => 1
)

I already read the documentation from https://secure.efaxdeveloper.com/downloads.jsp Outbound already set all the required fields on xml data and request post. But I always get this error from efax developer API:

Post Unsuccessful!
Your request has failed due to invalid data.
Please refer to our documentation prior to resubmitting.

Error Level: User
Error Message: XML data argument was not passed.

Please contact us at 888-278-8666 if you continue to encounter errors.

Error Message : XML data argument was not passed What is wrong with my xml data?

(*Note on my request the xml post parameter is set the encoded file contents of my xml).

  • 写回答

2条回答 默认 最新

  • duanhuang4841 2016-04-07 23:12
    关注

    I used PHP efax instead.

    PHP eFax is a PHP class that wraps the eFax® Developer API. Use PHP eFax to automate the task of sending and receiving faxes electronically from your PHP-powered web server.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序