2016-04-05 24 views
0

EHttpClient uzantısını kullanıyorum yii. Benim Kodu:EHttpClient Yii kullanarak giden efax geliştirici api isteği çalışmıyor

$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); 

Benim xml veriler: Zaten https://secure.efaxdeveloper.com/downloads.jsp Giden zaten gerekli tüm alanları ayarlamak gelen belgeleri okumak

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 
) 

:

<?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>[email protected]</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> 

İsteğimin bilgi xml veri ve istek sonrası. Ama her zaman efax geliştirici API bu hatayı alıyorum:

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. 

Hata mesajı: XML veri argüman benim xml verileri sorununun ne geçmedi ki?

(* İstek üzerine xml post parametresi, xml'nin kodlanmış dosya içeriklerini belirlemektedir).

cevap

1

Bunun yerine PHP efax kullandım.

PHP eFax, eFax® Developer API'sini tamamlayan bir PHP sınıfıdır. PHP ile çalışan web sunucunuzdan elektronik olarak faks gönderme ve alma görevini otomatikleştirmek için PHP eFax'ı kullanın.

0

Urlen kodunu kullanmayın. İçerik türünü sadece uygulama/x-www-form-urlencoded olarak ayarlayın.