1

Creation geofence from PHP

Topic: Creation geofence from PHP

Hello,

Client is trying to create geofence via PHP;

When creating the geofence there is no answer, he thinks it is due to PHP.

With another  type of coneccionts (ip/user/pwd) there are no problems but this type seems to cut the session.

what about other users, what language do they use to "attack" the API?

Thanks

Locating things
2

Creation geofence from PHP

Re: Creation geofence from PHP

Hello

We used many language and libraries to communicate with Wialon API. Including PHP. Here's topic about it https://forum.gurtam.com/viewtopic.php?id=6762

PS if you want to get help from programmers - show them some code wink

3

Creation geofence from PHP

Re: Creation geofence from PHP

Sorry;

Client makes:

//Conexión al Token
"http://hst-api.wialon.com/wialon/ajax.h … BF0437%22}";

//Update Zonas
,itemId:123456789,id:0,callMode:create}]https://hst-api.wialon.com/wialon/ajax.html?svc=resource/update_zone&params={"n":"0886001-40086","d":"08860,Castelldefels","id":9,"f":48,"t":3,"w":100,"e":30869,"c":2568583984,"i":4294967295,"libId":0,"path":"","b":{"min_x":1.98077005312,"min_y":41.2852616629,"max_x":1.98315754952,"max_y":41.287062325,"cen_x":1.98196380132,"cen_y":41.286161994},"ct":1519974344,"mt":1519974344}],"itemId":123456789,"id":0,"callMode":"create"} sid=SID_GENERADOR_POR_TOKEN

//Logout
https://hst-api.wialon.com/wialon/ajax. … _POR_TOKEN


When he make sthe call API UPDATE of geofences with the generated SID before, there is a problem, it tells me "there is not conexion" to server.

thanks

Locating things
4

Creation geofence from PHP

Re: Creation geofence from PHP

Here's working version

https://hst-api.wialon.com/wialon/ajax.html?svc=resource/update_zone&params={"n":"088600140086","d":"08860,Castelldefels","f":48,"t":3,"w":100,"c":2568583984,"p":[{"x":1.98077005312,"y":41.2852616629,"r":100}],"itemId":123456789,"id":0,"callMode":"create"}&sid=SID

I deleted not required parameters from your request
b = boundary, Wialon will calculate it for you
libId path = image, not required
ct mt = creation time, modification time
and some more

Hope this helps

5

Creation geofence from PHP

Re: Creation geofence from PHP

locationGPS, do not forget to delete your token. It's like login/password for bot and you posted it on public forum.

At the dark side of telematics...
6

Creation geofence from PHP

Re: Creation geofence from PHP

yes, I just did it fast...thanks for informing...regards

Locating things
7

Creation geofence from PHP

Re: Creation geofence from PHP

Hi again,
client test your post, he got same problem, he connects got the SID and when calling the update i was not possible already.

"
Before the Update He added the instruction given to know server state and it was "disconected", so it must be something about my conexion o in the session I uses that kicks me out.

I checked several PHP forum and it is not the first API that with this method (connection with token and validation with autogenerated token) that gives problems with PHP servers.

Do we have any example with other language or examples to check if I am doing it right"?

thanks

Regards

Locating things
8

Creation geofence from PHP

Re: Creation geofence from PHP

Problem is in php code and the question is how exactly your client sends requests

You can check our libraries on GitHub
https://github.com/wialon/python-wialon
https://github.com/wialon/php-wialon

9

Creation geofence from PHP

Re: Creation geofence from PHP

Hello, Client tried and now has this message:

{"error":4,"reason":"WRONG_PARAMS"}

any idea?
thanks

Locating things
10

Creation geofence from PHP

Re: Creation geofence from PHP

locationGPS wrote:

Hello, Client tried and now has this message:

{"error":4,"reason":"WRONG_PARAMS"}

any idea?
thanks

Show me your request params.

11

Creation geofence from PHP

Re: Creation geofence from PHP

Hi, attached

Post's attachments

Attachment icon Traycco.rar 2.95 kb, 307 downloads since 2018-04-04 

Locating things
12

Creation geofence from PHP

Re: Creation geofence from PHP

hi,
did you have time to check it?
thanks

Locating things
13

Creation geofence from PHP

Re: Creation geofence from PHP

locationGPS, in your request
echo $url= 'https://hst-api.wialon.com/wialon/ajax.html?svc=resource/update_zone&params={"n":"0886001-40086","d":"08860,Castelldefels","id":9,"f":48,"t":3,"w":100,"e":30869,"c":2568583984,"i":4294967295,"libId":0,"path":"","b":{"min_x":1.98077005312,"min_y":41.2852616629,"max_x":1.98315754952,"max_y":41.287062325,"cen_x":1.98196380132,"cen_y":41.286161994},"ct":1519974344,"mt":1519974344}],"itemId":123456789,"id":0,"callMode":"create"} sid='.$json_clientes["eid"];
replace space before sid with &

Head of Wialon Local Department
Gurtam
14

Creation geofence from PHP

Re: Creation geofence from PHP

Hello,

now seems works but had this error:

["error"]=> int(4) ["reason"]=> string(63) "VALIDATE_PARAMS_ERROR: {itemId: long, id: long, callMode: text}" }

¿?
thanks

Locating things
15

Creation geofence from PHP

Re: Creation geofence from PHP

locationGPS, here is your corrected request:

echo $url= 'https://hst-api.wialon.com/wialon/ajax.html?svc=resource/update_zone&params={"n":"0886001-40086","d":"08860,Castelldefels","id":9,"f":48,"t":3,"w":100,"e":30869,"c":2568583984,"i":4294967295,"libId":0,"path":"","b":{"min_x":1.98077005312,"min_y":41.2852616629,"max_x":1.98315754952,"max_y":41.287062325,"cen_x":1.98196380132,"cen_y":41.286161994},"ct":1519974344,"mt":1519974344}],"itemId":123456789,"id":0,"callMode":"create"}&sid='.$json_clientes["eid"];

There were missing parameters id, itemId, callMode.

Head of Wialon Local Department
Gurtam
16

Creation geofence from PHP

Re: Creation geofence from PHP

<?php

use Location\Coordinate;
use Location\Distance\Vincenty;

$coordinate1 = new Coordinate(19.820664, -155.468066); // Mauna Kea Summit
$coordinate2 = new Coordinate(20.709722, -156.253333); // Haleakala Summit

$calculator = new Vincenty();

echo $calculator->getDistance($coordinate1, $coordinate2); // returns 128130.850 (meters; ≈128 kilometers)

Are you looking for Best Gifts and Toys for 3 Year Old girls (Review) in 2020. Get the list of best toys for your 3 years old Girls.
17

Creation geofence from PHP

Re: Creation geofence from PHP

Could you tell me where (which line) you take every single coordinate before you connect all of them in a string?
Thanks for your work!

Are you Looking for Best Baby Bikes or cycles ? Get Reviews and complete details about Best Bikes, Trikes and Striders for Toddlers.
18

Creation geofence from PHP

Re: Creation geofence from PHP

hi
close it.
Thansk

Locating things