0

私はこのXMLを送信する必要がある非常に悪いAPIを扱っています:

<?xml_version string(335) ""1.0" encoding="utf-16"?>
<GetTicketAction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <CompanyName>*name*</CompanyName>
    <IntegrationLoginId>*id*</IntegrationLoginId>
    <IntegrationPassword>*password*</IntegrationPassword>
    <SrServiceRecid>*recordId*</SrServiceRecid>
</GetTicketAction>

actionString私の管理下にないサーバーへのPOST(as)経由。JavaScript(クロススクリプトではできませんでした)とCURL(「これは暗号化する必要がありますエラー」)で試しました。暗号化については、ドキュメントのどこにも記載されていません。これは、「完全な信頼」を使用してIEのJSで暗号化を実行できることを示しています。

コンテンツタイプはapplication/x-www-form-urlencoded、それが役立つ場合です。

これをJSまたはPHP、あるいはその両方で送信する方法はありますか?

4

1 に答える 1

0

After many painful years of this API slowly driving me insane, I discovered that it did NOT want me to send the XML through the standard CURL pattern of

$data = array(
    "actionString" => $xml
);

Rather, I was to do:

$data = 'actionString=<?xml_version string(335) ""1.0" encoding="utf-16"?>
<GetTicketAction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <CompanyName>*name*</CompanyName>
    <IntegrationLoginId>*id*</IntegrationLoginId>
    <IntegrationPassword>*password*</IntegrationPassword>
    <SrServiceRecid>*recordId*</SrServiceRecid>
</GetTicketAction>'

Future API writers: Let this be a warning. I'm really hoping a crazed psychopath knows where this guy sleeps.

于 2012-08-08T12:58:59.167 に答える