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)
Facebooktwitterredditpinterestlinkedinmail

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()
            {
                $this->registerPolicies();
                // 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']);
                    });
                //
            }
        }
        
Facebooktwitterredditpinterestlinkedinmail

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
            </th>
        </thead>
        <tbody>
    	</tr><tr>
    		<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>
    	</tr>
        </tbody>
    </table>
    <img id="image" src="spinner.gif" alt="wait..." style="display: none;">
    <br>
    
</section>	
<section id=food>
	<h3 id="notification"></h3>
</section>

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

Facebooktwitterredditpinterestlinkedinmail

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º:

Facebooktwitterredditpinterestlinkedinmail

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'); ?>
or
<?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

Facebooktwitterredditpinterestlinkedinmail

Read More ...

Categories

Subscribe to my Newsletter




By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close