Files
crm.twinpol.com/modules/Schedulers/orderEditor.php
2025-05-12 15:44:39 +00:00

40 lines
961 B
PHP

<?php
ini_set('display_errors',1);
class orderEditor{
public $sXe;
public $file2;
public function __construct($file,$file2){
//copy($file,$file2);
$this->file2=$file2;
$this->sXe = new SimpleXMLElement(file_get_contents($file2), LIBXML_NOEMPTYTAG);
}
public function modifyBuyer(){
$this->sXe->{"Order-Parties"}->Buyer->ILN='5909000837';
}
public function saveFile(){
$content = $this->sXe->asXML();
file_put_contents($this->file2,str_replace('<?xml version="1.0"?>',"",$content));
}
public function sendFile(){
$connection = ssh2_connect('crm.e5.pl', 22);
ssh2_auth_password($connection, 'mz', '56!@HjU&3aZ');
$sftp = ssh2_sftp($connection);
echo "przenosze plik ".$this->file2;
ssh2_scp_send($connection, $this->file2, '/home/mz/'.uniqid().'.xml', 0775);
}
}
/*
$file2='/home/saas/orders/e5/MEDI_OR139781914.xml';
$ob = new orderEditor();
$ob->modifyBuyer();
$ob->saveFile();
$ob->sendFile();
echo 'skonczone';*/
?>