Jump to content

CURL XML Request [From C to PHP]


Joey1

Recommended Posts

Hi, 

 

I need some help converting this into something that will work with PHP.

 

#!/bin/sh

#URL="https://www.site.com/webservices/Affiliates/affiliates.cfc"
URL="https://www.site.com/webservices/partners/products.cfc"
XMLFILE=tmp_xml.xml

cat <<DONE | sed -e 's/\&/\&/g' \
		-e 's/</\</g' \
		-e 's/>/\>/g' \
	> ${XMLFILE}.encoded
<?xml version="1.0" encoding="UTF-8"?>
<services user="USER" password="PASS">
<company>
	<request>
		<type>Products</type>
	</request>
</company>
</services>
DONE


#curl -v -d @- "${URL}" -H 'SOAPAction: AffiliatesAPI' <<DONE

curl --trace trace.txt -d @- "${URL}" -H 'SOAPAction: AffiliatesAPI' <<DONE
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
	<Request>
		<xmlString>`cat ${XMLFILE}.encoded`</xmlString>
	</Request>
</soap:Body>
</soap:Envelope>
DONE

 

Cheers

Link to comment
https://forums.phpfreaks.com/topic/180980-curl-xml-request-from-c-to-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.