Тема: Error :4 on Import WLP with php wialon master
I started to developed my own app with PHP Wialon master, I’m trying to import a WLP to the platform but I’m getting Error:4 for every time I trying to execute.
I generate the WLP automatically and I get a file with all the configuration, I leave a part below (It’s well-formed because I prove to import directly to the platform and ain’t getting any problem).
However when I try to import through php code I getting error:4, I know that my code is wrong but maybe you can help to see how to do it. I leave it below.
I will really appreciate all your opinion and tips.
Thanks in advance
<?php
include('wialon.php');
$wialon= new Wialon();
date_default_timezone_set('America/Mexico_City');
$token="token number";
$result= $wialon->login($token);
$json=json_decode($result, true);
$hash="";
$hash.='Request Method: POST\n';
$hash.='Connection: keep-alive \n';
$hash.='Content-Length: 1901 \n';
$hash.='Cache-Control: no-cache\n';
$hash.='Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryhAXcAjtvh1D61XpC\n';
$hash.='Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\n';
$hash.='Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.3\n';
$hash.='Accept-Encoding: gzip,deflate,sdch\n';
$hash.='Accept-Language: ru,en-US;q=0.8,en;q=0.6\n';
$hash.='------WebKitFormBoundaryhAXcAjtvh1D61XpC\n';
$hash.='Content-Disposition: form-data; name="params"\n';
$hash.='{"eventHash":"jUploadForm1372772377019"}\n';
$hash.='------WebKitFormBoundaryhAXcAjtvh1D61XpC\n';
$hash.='Content-Disposition: form-data; name="eventHash"\n';
$hash.='jUploadForm1372772377019\n';
//Here I put directly the WLP formed
$hash.='------WebKitFormBoundaryhAXcAjtvh1D61XpC\n';
$hash.='Content-Disposition: form-data; name="import_file"; filename="file.zip"\n';
$hash.='Content-Type: application/x-zip-compressed\n';
$hash.='------WebKitFormBoundaryhAXcAjtvh1D61XpC--\n';
$params=array(
"eventHash"=>$hash
);
$ejecucion=$wialon->svc_exchange_import_json(json_encode($params));
$ejex=json_decode($ejecucion,true);
echo $ejecucion;
?>