Bad request error when posting xml using curl -


While dragging my hair in an attempt to solve this problem, I am getting a bad request error while posting on XML using curls. My code is:
  $ post_string = '& lt; XML Data & gt; '; $ Ch = curl_init (); Curl_setopt ($ CH, CURLOPT_HTTPHEADER, array ('content-type: text / xml; charset = UTF-8', 'SOAPAction: ""' ')); Curl_setopt ($ CH, CURLOPT_POST, 1); Curl_setopt ($ ch, CURLOPT_URL, $ url); Curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ post_string); Curl_setopt ($ CH, CURLOPT_RETURNTRANSFER, 1); $ Data = curl_xac ($ ch); Var_dump ($ data);   

Any ideas on what is wrong?

Below is my XML string

  & lt ;? Xml version = "1.0" encoding = "utf-8" & gt; & Lt; Soap: envelope xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns: xsd = "http://www.w3.org/2001/XMLSchema" xmlns: soap = "http: //schemas.xmlsoap.org/soap/envelope/"> & Lt; Soaps: Body & gt; & Lt; SubmitLead xmlns = "" & gt; & Lt; XmlLead & gt; & Lt; Leads & gt; & Lt; General & gt; & Lt; Merchant Type = "CMH" & gt; 273 & lt; / Dealer & gt; & Lt; Source Ref = "StockID" & gt; 3256 & lt; / Source & gt; & Lt; Investigation & gt; & Lt; / Investigation & gt; & Lt; Sub type & gt; & Lt; / Sub type & gt; & Lt; Comment & gt; & Lt; / Comment & gt; & Lt; / General> & Lt; Chance & gt; & Lt; Title & gt; N.a & lt; / Title & gt; & Lt; Name & gt; J & lt; / Name & gt; & Lt; Surname & gt; Meter & lt; / Nickname & gt; & Lt; Email & gt; Jm@test.com< / Email & gt; & Lt; Home & gt; Home & lt; / Home & gt; & Lt; Work & gt; N.a & lt; / Work & gt; & Lt; Mobile & gt; 4545 & lt; / Mobile & gt; & Lt; IDNumber & gt; N.a & lt; / IDNumber & gt; & Lt; Comment & gt; 4545 & lt; / Comment & gt; & Lt; Region & gt; N.a & lt; / Region & gt; & Lt; / Prospect & gt; & Lt; Item & gt; & Lt; ID & gt; 25DLC61717 & lt; / Id & gt; & Lt; MakeAsked & gt; & Lt; / MakeAsked & gt; & Lt; ModelAsked & gt; & Lt; / ModelAsked & gt; & Lt; YearAsked & gt; & Lt; / YearAsked & gt; & Lt; MileageAsked & gt; & Lt; / MileageAsked & gt; & Lt; PriceAsked & gt; & Lt; / PriceAsked & gt; & Lt; ColoredAsked & gt; & Lt; / ColorAsked / & gt; & Lt; Registration & gt; & Lt; / Registration & gt; & Lt; Win & gt; & Lt; / Win> & Lt; PurchaseDate / & gt; & Lt; / PurchaseDate & gt; & Lt; / Item & gt; & Lt; / Lead & gt; & Lt; / XmlLead & gt; & Lt; / SubmitLead & gt; & Lt; / Soap: Body & gt; & Lt; / Soap: Envelope & gt;    

Maybe there is a bad request because XML is not valid XML?

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -