PHP M2Web

Hello, I’m looking to develop a wordpress plugin for getting data from M2Web to Wordpress for a a simple dashboard. Some help with this plugin would be much appreciated. I have read through the php documentation for the api, but haven’t been able to come up with the proper wizardly incantation to make it work. attached is the wordpress plugin code structure. I want to just call the data in php and reload it every second. `<?php
/*
Plugin Name: EWON DATA
Plugin URI: http://solvedsystems.com
Description: Retrieve EWON DATA
Author:XX
Version: 1.0
*/
defined(‘ABSPATH’) or die (‘Unauthorized Access!’);

add_action(‘admin_init’,‘callback_function_name’);

function callback_function_name(){
echo’You are now logged into the admin area’;
}

$url = ;
$response = wp_remote_get ($url,
array(
    'method' =>'GET'
    )

);
if(is_wp_error($response)){
$error_message = $response->get_error_message();
echo"Something went wrong:$error_message";
}
echo ‘

’;
var_dump(wp_remote_body($response));
echo’
’;
}`

Hi Jeff,

This would be a good question for the Ewon Developer Forum or maybe our Solution Center. I will touch base with them to see if they have any input about this.

Kyle

@side_hms
@oliver_hms

Hi Jeff,

If you haven’t already come across this, some additional documentation on how to construct the requests can be found here. https://developer.ewon.biz/content/m2web-api-0
To get the URL you may want to look into section 5.3.2 of that documentation.

From @side_hms:

I do not quite understand what he wants but if he simply wants to call a php script from his webpage and the php script should return Ewon data, he could use something similar to that :

<?php

error_reporting(0);

$EwonName = "Flexy1";

$account = "xxxx";

$login = "xxxx";

$password = "xxxx";

$EBD= "$dtIV$ftT";

$data = file_get_contents('https://m2web.talk2m.com/t2mapi/get/'.$EwonName.'/rcgi.bin/ParamForm?AST_Param='.$EBD.'&t2maccount='.$account.'&t2musername='.$login.'&t2mpassword='.$password.'&t2mdeveloperid=61e88c64-6ade-453e-ad4e-a79dde788010');

echo $data;

?>

Great thank you! I am trying to build a Wordpress Plugin (written in .php) that pulls in M2Web data. I am not well versed in .php hence my struggle. I thoroughly reviewed the .php ewon documents, but couldn’t put together the right combination of parameters to pull data in. :slight_smile:

That’s really cool! Keep me posted. I’m also not well versed in PHP, but Simon is.