PHP Classes

how to use http_arguments post xml only?

Recommend this page to a friend!

      PHP OAuth Library  >  All threads  >  how to use http_arguments post xml only?  >  (Un) Subscribe thread alerts  
Subject:how to use http_arguments post xml only?
Summary:returned "Content-Type: multipart/form-data"
Messages:5
Author:allenmao
Date:2015-04-29 04:58:24
 

 


  1. how to use http_arguments post xml only?   Reply   Report abuse  
Picture of allenmao allenmao - 2015-04-29 04:58:24
hi there,

i tried

$client->http_arguments = array('RequestMethod'=>'POST','PostFiles'=>array('userfile'=>array('FileName'=>'newjob.xml','Content-Type'=>'application/xml')));

and i get:

Content-Type: multipart/form-data; boundary=--ca8d5e98fae617786e7a489da3fc5af0
Content-Leng......

what i want is to post pure application/xml file to the server, is it possibile? thanks

  2. Re: how to use http_arguments post xml only?   Reply   Report abuse  
Picture of allenmao allenmao - 2015-04-29 05:11:00 - In reply to message 1 from allenmao
after seeing :

$arguments["RequestMethod"]="POST";
$arguments["Headers"]["SoapAction"]="";
$arguments["Headers"]["EndPointURL"]="http://www.atlaz.net/webservices/GetCurrencyExchange.php";
$arguments["Headers"]["Content-Type"]="text/xml; charset=\"utf-8\"";
$arguments["Body"]="<?xml version='1.0' encoding='UTF-8'?>....";

i am trying to do something like this, but failed:

$client->http_arguments = array('RequestMethod'=>'POST','Content-Type'=>'text/xml','Body'=>$xml);

  3. Re: how to use http_arguments post xml only?   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2015-04-29 05:12:34 - In reply to message 1 from allenmao
If you want to send a XML file as request body, just set the RequestContentType option to 'application/xml' and set the RequestBody option to the file contents.

$options = array(
'RequestContentType'=>'application/xml',
'RequestBody'=>file_get_contents('newjob.xml')
);

  4. Re: how to use http_arguments post xml only?   Reply   Report abuse  
Picture of allenmao allenmao - 2015-04-29 05:27:13 - In reply to message 3 from Manuel Lemos
$client->http_arguments = array($options=array('RequestContentType'=>'application/xml','RequestBody'=>file_get_contents('newjob.xml'));


not working!

  5. Re: how to use http_arguments post xml only?   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2015-04-29 05:34:56 - In reply to message 4 from allenmao
No, it is the $options parameter of the CallAPI function.