So I’m relatively new to PHP, and definitely new to OOP. I’d love some help here!
I’m trying to use CURL to retrieve an XML document from another piece of software running on the server, and I think a plugin will be sufficient for this. I’m using the CURLOPT_POSTFIELDS option below to include the necessary information for authentication, etc.
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);$postfields is an array, and in a normal PHP doc, I’d just include this:
$postfields["username"] = "XXXXXXXX"; // API username
$postfields["password"] = "XXXXXXXX"; // API password
$postfields["responsetype"] = "xml";However, it doesn’t look like I can create an associative array inside the plugin’s class, can I? Could anyone shed some light on this?
Well I found this on Stack Overflow, but I’m not sure it’s what I need to be doing. Is it?
My plugin, at this moment, is pretty much scrambled bits of code. Basically, I need to set the variables (seen in the second code block above) so that they can be used as an array in the CURLOPT_POSTFIELDS option (seen in the first block of code).
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.