Category Archives: PHP

Best way to consume Dynamics NAV web services from external php application

After investigating a bit the connection alternatives to the services of Microsoft Dynamics NAV webservices from an external platform, specifically a web application programmed with PHP and Laravel framework, I have reached the following conclusions:

  • from PHP it is much easier to use OData + json
  • Modern versions of Dynamics NAV (2016/2017) allow connection by OData
  • Through OData you can obtain, register new records and also delete records. with the verbs (GET / POST / PUT / DELETE)

Read More ...

Laravel custom Authentication, With Microsoft Dynamics NAV Odata Webservice (table Customers)

I was created one project with laravel 5.4 and custom authentication to one table of Dynamics NAV (2017) trough web services, these are the steps that I was make to do this:

  • I was folow some steps As this article explains perfectly: CustomUserProvider.php 
      • Modify config/auth.php:
            'providers' => [
                'users' => [
                    //'driver' => 'eloquent',
                    'driver' => 'customuserprovider',
                    'model' => App\User::class,
                // 'users' => [
                //     'driver' => 'database',
                //     'table' => 'users',
                // ],
      • but then Modify providers/AuthServiceProvider to use my own customuserprovider:
         <?php namespace App\Providers; use Illuminate\Support\Facades\Gate; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; class AuthServiceProvider extends ServiceProvider { /** * The policy mappings for the application. * * @var array */ protected $policies = [ 'App\Model' => 'App\Policies\ModelPolicy',
             * Register any authentication / authorization services.
             * @return void
            public function boot()
                // added to modify auth provider that's the trick
                 \Illuminate\Support\Facades\Auth::provider('customuserprovider', function($app, array $config) {
                return new CustomUserProvider($app['hash'], $config['model']);

Read More ...

How to make an ajax call inside a WordPress site

After several days, finally I found how to make ajax call from my wordpress site, I hope that it will help those who have had this problem:

first, I was created a post inside a wordpress whit this html code:

<section id="main">
    <table id="tng" class="datagrid">
    	<thead><tr><th colspan="3"> 
            Sample ping App
    		<td width="50%" align="right"><b>Host or IP:</b></td>
    		<td><input  id="ip" size="20" value="" ></td>
                <td><button type="button" onclick="PING()">Ping</button></td>
    <img id="image" src="spinner.gif" alt="wait..." style="display: none;">
<section id=food>
	<h3 id="notification"></h3>

As you can see the only important thing is the onclick event for the button that calls de functionPING()


Read More ...

Sample ajax calls inside WordPress

This is a sample page to demostrate how to use ajax calls inside wordpress,
if you test the below button, you can do a ping to a host or ip without reload the web page, it shows the results and then deletes itself.

Ping Host or IP:
Blacklist check Host or IP:
Telnet, Host or IP / Port Nº:


Read More ...

WordPress and WPML

Notes about WordPress and WPML:

Once installed wordpress and wpml, we can activate the translation of strings, if our subject is properly adjusted, in the files of the subject appearing chains type:

<?php _e('NIF', 'afegit'); ?>
<?php __('NIF', 'afegit'); ?>

in this case “Afegit” will be the domain of WPML string translation within WPML –> Themes and Plugins, we will have to check for new translations (first image), if we modify the theme files or add new fields to which we add translation functionality


Read More ...


Subscribe to my Newsletter