Home › Forums › Feature Suggestions › Additional Addons To Consider
Tagged: integration, osclass, php
- This topic has 1 reply, 2 voices, and was last updated 8 years, 2 months ago by
admin.
- AuthorPosts
- June 27, 2015 at 7:21 pm #1273
Stephen
ParticipantOk so so Im being a little selfish here in that I am going to mention possibilities for plugins for PhpMyDirectory and my current issue involving OsClass.
I will be eventually moving onto phpmydirectory to try and integrate it with IEM but im currently trying to get OsClass integrated.
I have a php page that works great with iDevAffiliate and IEM and am trying to get it to work with OsClass.
Heres what Ive got so far but doesnt work like the iDevAffiliate integration. I cant see the iDev Registration Page that calls the mailing_list.php whcih then sends to IEM because iDev have encoded the page.
If anyone has an idea Id appreciate it. If not its a possibility for a osClass plugin.
Heres the code.
<?PHP
function IEM_subscribe($userId) {
$user = User::newInstance()->findByPrimaryKey($userId);
if ($MailingListAuth == true) {
$s_name = check_type(‘$s_name’);
$s_email = check_type(‘$s_email’);
$xml = ‘<xmlrequest>
<username>ADMIN</username>
<usertoken>TOKEN</usertoken>
<requesttype>subscribers</requesttype>
<requestmethod>AddSubscriberToList</requestmethod>
<details>
<emailaddress>’.$s_mail.'</emailaddress>
<mailinglist>2</mailinglist>
<format>html</format>
<confirmed>yes</confirmed>
<customfields>
<item>
<fieldid>2</fieldid>
<value>’.$s_name.'</value>
</item>
</customfields>
</details>
</xmlrequest>
‘;
$ch = curl_init(‘https://mysite.com/mail/xml.php’); //CHANGE TO THE PATH OF YOUR IEM INSTALLATION
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
$result = @curl_exec($ch);
if($result === false) {die(“Error performing request”);}
//var_dump($result); //for debugging purposes
//Example of how to display returned data
$xml_doc = simplexml_load_string($result);
if ($xml_doc->status == ‘SUCCESS’ && empty($xml_doc->data)) {die(‘Status is success. Empty response.’);}
if ($xml_doc->status == ‘SUCCESS’) {
echo ‘Response: <br />’;
var_dump($xml_doc->data);
} else {
echo ‘Error is ‘. $xml_doc->errormessage;
}
}
osc_add_hook(‘user_register_completed’, ‘IEM_subscribe’);
?>
Any tips would be great.
By the way forum is great Jacob, thanks.
July 14, 2015 at 3:04 pm #1317admin
ParticipantThis is an interesting issue. Its funny how often we are dependent on the integration of different platforms to make something come together. I’ll try to talk to a few of our developers and let you know if they have an idea out the gate but we don’t do much with Osclass so I’m not sure how helpful we will be.
- AuthorPosts
- You must be logged in to reply to this topic.