Jump to content

Vixushr

Members
  • Posts

    36
  • Joined

  • Last visited

    Never

Everything posted by Vixushr

  1. Helo, Ihave one script that servers as download link for my customers to download pricelist in XML form. Script it self works but problem is that my host upgraded PHP on servers and script now works only if theres one less field to generate in XML. This is script <?php $langHr = 7; include(dirname(__FILE__).'/config/config.inc.php'); require_once(dirname(__FILE__).'/init.php'); error_reporting(0); $p=Product::getProducts(7, 0, 0, 'id_product', 'desc', false); $products=Product::getProductsProperties(7, $p); header("Content-Type: text/xml\n\n"); //print "Content-type: text/html\n\n"; echo '<?xml version="1.0" encoding="utf-8"?> <Catalog>'; foreach ($products as $row) { if($row['active']==1){ $img=Product::getCover($row['id_product']); if ($row['quantity'] >= 5) { $row['quantity'] = "5"; } echo ' <product> <ID>'.str_replace("&", "&", $row['id_product']).'</ID> <name>'.str_replace("&", "&", $row['name']).'</name> <description>'.str_replace("&", "and", strip_tags($row['description_short'])).'</description> <price>'.($row['price']*1).'</price> <quantity>'.str_replace("&", "&", $row['quantity']).'</quantity> <category>'.str_replace("&", "&", $row['category']).'</category> <link>'.$row['link'].'</link> <image>http://www.myshop/'.$shopUrl.'img/p/'.$row['id_product'].'-'.$img['id_image'].'.jpg</image> echo'</product>'; } } echo '</Catalog>'; ?> And since these server changes this script now works only if i remove one row from product data... any row, it doesnt mather... as long as theres only 7 of them? Can anybody tell me what causes this... what to change on server to make it work, or how to change a script? Thank you! V. PS: Sever was updated from php 5.2 to 5.3
  2. Helo, I need big help how to adjust this code to new PHP 5.3 that dont support egeri any more public static function blacklist(&$query) { return eregi(self::$_blacklist, $query) ? true : false; } HELP ! ! !
  3. i have have trouble fetching it.
  4. Helo, i am still fighting with it... iw tryed this way function megatrend_download() { $local = dirname(__FILE__); $path = $local."/xml/megatrend.xml"; $path1 = $local."/xml/megatrend1.xml"; $postData = array('username'=>'xxx','password'=>'xxx','OIB'=>'xxx'); $curl2 = curl_init(); curl_setopt($curl2, CURLOPT_URL, 'http://shop.megatrend.com/ClientWebServices/ClientWS.asmx'); curl_setopt($curl2, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl2, CURLOPT_HEADER, false); curl_setopt($curl2, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl2, CURLOPT_POSTFIELDS, $postData); but still error thit i get is: Server was unable to process request. ---> Data at the root level is invalid. Line 1, position 1.
  5. Helo, I need some help with downloading xml from remote server using SOAP in PHP this is sample SOAP code that i have from server: http://shop.megatrend.com/ClientWebServices/ClientWS.asmx POST /ClientWebServices/ClientWS.asmx HTTP/1.1 Host: shop.megatrend.com Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://shop.megatrend.com/ClientWebServices/GetProducts" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <GetProducts xmlns="http://shop.megatrend.com/ClientWebServices/"> <username>string</username> <password>string</password> <OIB>string</OIB> </GetProducts> </soap:Body> </soap:Envelope> HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <GetProductsResponse xmlns="http://shop.megatrend.com/ClientWebServices/"> <GetProductsResult> <WsProduct> <PN>string</PN> <Code>string</Code> <Name>string</Name> <Description>string</Description> <Manufacturer>string</Manufacturer> <Weight>decimal</Weight> <Available>boolean</Available> <Stock>int</Stock> <Warranty>string</Warranty> <Price>decimal</Price> <Images> <WsImage xsi:nil="true" /> <WsImage xsi:nil="true" /> </Images> <Descriptions> <WsDescriptionData xsi:nil="true" /> <WsDescriptionData xsi:nil="true" /> </Descriptions> </WsProduct> <WsProduct> <PN>string</PN> <Code>string</Code> <Name>string</Name> <Description>string</Description> <Manufacturer>string</Manufacturer> <Weight>decimal</Weight> <Available>boolean</Available> <Stock>int</Stock> <Warranty>string</Warranty> <Price>decimal</Price> <Images> <WsImage xsi:nil="true" /> <WsImage xsi:nil="true" /> </Images> <Descriptions> <WsDescriptionData xsi:nil="true" /> <WsDescriptionData xsi:nil="true" /> </Descriptions> </WsProduct> </GetProductsResult> </GetProductsResponse> </soap:Body> </soap:Envelope> this is piece of PHP code that i have that shud handle request: function megatrend_download() { $local = dirname(__FILE__); $path = $local."/xml/megatrend.xml"; $path1 = $local."/xml/megatrend1.xml"; $request = array('username'=>'xxx','password'=>'xxx','oib'=>'xxx'); postPage($request,'http://shop.megatrend.com/ClientWebServices/GetProducts'); $curl2 = curl_init(); curl_setopt($curl2, CURLOPT_URL, 'http://shop.megatrend.com/ClientWebServices/ClientWS.asmx'); curl_setopt($curl2, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl2, CURLOPT_HEADER, false); curl_setopt($curl2, CURLOPT_RETURNTRANSFER, true); ...rest of functions... I am clearly missing something but i just cant get it! Help!
  6. Thank you for replay, but... this way i am trying to limit only one part of the script (dont ask why)... can i do it this way?
  7. Helo, i need some pointer regarding "set_time_limit " command. Can i use it more times in the same script to separate jobs that i need to be runned longer than others? eg: <?php set_time_limit(0); include('abc.php'); echo "<pre>"; set_time_limit(90); $products = test_getxmlinfo(); set_time_limit(0); include('def.php'); echo "<pre>";
  8. more help needed... Iw found this script: <?php /** PHP Kill Process Sometimes, it can happen a script keeps running when it shouldn't, and it won't stop after we close the browser, or shutdown the computer. Because it's not always easy to use SSH there's a workaround. @author Jensen Somers < php@jsomers.be> @version 1.0 */ class KillAllProcesses { /** * Construct the class */ function killallprocesses() { $this->listItems(); } /** * List all the items */ function listItems() { /* * PS Unix command to report process status * -x Select processes without controlling ttys * * Output will look like: * 16479 pts/13 S 0:00 -bash * 21944 pts/13 R 0:00 ps x * */ $output = shell_exec('ps x'); $this->output($output); // Put each individual line into an array $array = explode("\n", $output); $this->doKill($array); } /** * Print the process list * @param string $output */ function output($output) { print "<pre>".$output."</pre>"; } /** Kill all the processes It should be possible to filter in this, but I won't do it now. @param array $array */ function doKill($array) { /* Because the first line of our $output will look like PID TTY STAT TIME COMMAND we'll skip this one. */ for ($i = 1; $i < count($array); $i++) { $id = substr($array[$i], 0, strpos($array[$i], ' ?')); shell_exec('kill '.$id); } } } new KillAllProcesses(); ?> It works well and it kills all processes Now mine processes have constant COMMAND and PID is normaly, allways different... question now is can i kill proces by COMMAND instead of PID? tnx.
  9. Just one question... Is it possible to insert set_time_limit to parts of the script like this, will it work? <?php set_time_limit(0); include('curl.php'); echo "<pre>"; set_time_limit(90); $products = test_getxmlinfo(); //print_r($products); if(empty($_GET['action']) && $argc != 3) die('wrong args'); if($_GET['action']=='price' || ($argv[1] == 'action' && $argv[2]=='price')){ getxml(); updatePrice($products); } if($_GET['action']=='state' || ($argv[1] == 'action' && $argv[2]=='state')){ getxml(); updateState($products); } if($_GET['action']=='xxxx' || ($argv[1] == 'download' && $argv[2]=='xxxx')){ xxxx_download(); } if($_GET['action']=='xxxx' || ($argv[1] == 'download' && $argv[2]=='xxxx')){ xxxx_download(); } if($_GET['action']=='xxxx' || ($argv[1] == 'download' && $argv[2]=='xxxx')){ xxxx_download(); } if($_GET['action']=='xxxx' || ($argv[1] == 'download' && $argv[2]=='xxxx')){ xxxx_download(); } if($_GET['action']=='xxxx' || ($argv[1] == 'download' && $argv[2]=='xxxx')){ xxxx_download(); } if($_GET['action']=='xxxx' || ($argv[1] == 'download' && $argv[2]=='xxxx')){ xxxx_download(); } if($_GET['action']=='xxxx' || ($argv[1] == 'download' && $argv[2]=='xxxx')){ xxxx_download(); } set_time_limit(0); function updatePrice($products) { foreach($products as $key=>$value) { if(updateProductPrice($value)) { echo "<pre>"; print_r($key); echo "success"; echo "<pre>"; } else { echo "<pre>"; print_r($key); echo "not-change"; echo "<pre>"; } } } function updateState($products) { foreach($products as $key =>$value) { //updateProductState($value); $id = $key; $id_supplier = getAllProducts($id); if($id_supplier) { if($id_supplier[0]['id_supplier']==89) { $supplier = "xxxx"; } else if($id_supplier[0]['id_supplier']==3) { $supplier = "xxxx"; } else if($id_supplier[0]['id_supplier']==4) { $supplier = "xxxx"; } else if($id_supplier[0]['id_supplier']==90) { $supplier = "xxxx"; } else if($id_supplier[0]['id_supplier']==91) { $supplier = "xxxx"; } else if($id_supplier[0]['id_supplier']==92) { $supplier = "xxxx"; } else if($id_supplier[0]['id_supplier']==169) { $supplier = "xxxx"; } else if($id_supplier[0]['id_supplier']==167) { $supplier = "xxxx"; } else { $supplier = ""; } if($supplier=="") { echo "<pre>"; print_r($key); echo "not-change"; echo "<pre>"; } else { if(checkQTY($products[$id][$supplier],$supplier,$id)) { echo "<pre>"; print_r($key); echo "success"; echo "<pre>"; } else { //updatePrice($products); if(updateProductPrice($value)) { echo "<pre>"; print_r($key); echo "success"; echo "<pre>"; } else { echo "<pre>"; print_r($key); echo "not-change"; echo "<pre>"; } } } } } } ?>
  10. I agree, and if i can't find some easy fix i will hire someone... problem is that i can't hire localy (security and competition wise) and to hire an online professional is what i am now trying to fix... he made a script, it worked ok. but now (since we changed host) it has problems with tasks and i can't find that pro anymore...
  11. Well, problem is that i am not coder but i must somehow fix that... Is i possible to insert: set_time_limit(); in a certain part of the script rather than to be on the beginig of the entire script? Can I that way set different times for each particular task?
  12. Sorry for the double post but i assumed since this thread went the wrong way that start fresh i better idea. Anyway mine problem still stands, for some reason certain tasks dont close as they shud so i am looking for the solution to kill tham by PID... ir do you have any other ideas? Thanx!
  13. Helo, i have one script that leaves active tasks from time to time. I need to implement some sort od process ID tracking and to set KILL task command on every task that remains active for more than lets say 30 minutes. Is this doable, can anyone help me on this?
  14. hm... Let me just get clear on one thing... i don't want to stop cron from executing the script. I want to terminate tasks that are remined active after they are executed. Will this do it?
  15. path: /home/vixushr/supplierinfo iw copied path from existing cron: /usr/bin/php -c /home/vixushr /home/vixushr/supplierinfo/request.php
  16. i kept that cronControl.txt name, i'w set proper path and set 777 path: /home/vixushr/supplierinfo iw copied path from existing cron: /usr/bin/php -c /home/vixushr /home/vixushr/supplierinfo
  17. Yes you are right, i replaced relevant data that is not for public with XXXX.
  18. it is PHP script: <?php set_time_limit(0); include('curl.php'); echo "<pre>"; $products = test_getxmlinfo(); //print_r($products); if(empty($_GET['action']) && $argc != 3) die('wrong args'); if($_GET['action']=='price' || ($argv[1] == 'action' && $argv[2]=='price')){ getxml(); updatePrice($products); } if($_GET['action']=='state' || ($argv[1] == 'action' && $argv[2]=='state')){ getxml(); updateState($products); } if($_GET['action']=='xxxx' || ($argv[1] == 'download' && $argv[2]=='xxxx')){ xxxx_download(); } if($_GET['action']=='xxxx' || ($argv[1] == 'download' && $argv[2]=='xxxx')){ xxxx_download(); } if($_GET['action']=='xxxx' || ($argv[1] == 'download' && $argv[2]=='xxxx')){ xxxx_download(); } if($_GET['action']=='xxxx' || ($argv[1] == 'download' && $argv[2]=='xxxx')){ xxxx_download(); } if($_GET['action']=='xxxx' || ($argv[1] == 'download' && $argv[2]=='xxxx')){ xxxx_download(); } if($_GET['action']=='xxxx' || ($argv[1] == 'download' && $argv[2]=='xxxx')){ xxxx_download(); } if($_GET['action']=='xxxx' || ($argv[1] == 'download' && $argv[2]=='xxxx')){ xxxx_download(); } function updatePrice($products) { foreach($products as $key=>$value) { if(updateProductPrice($value)) { echo "<pre>"; print_r($key); echo "success"; echo "<pre>"; } else { echo "<pre>"; print_r($key); echo "not-change"; echo "<pre>"; } } } function updateState($products) { foreach($products as $key =>$value) { //updateProductState($value); $id = $key; $id_supplier = getAllProducts($id); if($id_supplier) { if($id_supplier[0]['id_supplier']==89) { $supplier = "xxxx"; } else if($id_supplier[0]['id_supplier']==3) { $supplier = "xxxx"; } else if($id_supplier[0]['id_supplier']==4) { $supplier = "xxxx"; } else if($id_supplier[0]['id_supplier']==90) { $supplier = "xxxx"; } else if($id_supplier[0]['id_supplier']==91) { $supplier = "xxxx"; } else if($id_supplier[0]['id_supplier']==92) { $supplier = "xxxx"; } else if($id_supplier[0]['id_supplier']==169) { $supplier = "xxxx"; } else if($id_supplier[0]['id_supplier']==167) { $supplier = "xxxx"; } else { $supplier = ""; } if($supplier=="") { echo "<pre>"; print_r($key); echo "not-change"; echo "<pre>"; } else { if(checkQTY($products[$id][$supplier],$supplier,$id)) { echo "<pre>"; print_r($key); echo "success"; echo "<pre>"; } else { //updatePrice($products); if(updateProductPrice($value)) { echo "<pre>"; print_r($key); echo "success"; echo "<pre>"; } else { echo "<pre>"; print_r($key); echo "not-change"; echo "<pre>"; } } } } } } ?>
  19. I agree, but in this case i am stuck with "tape" becouse i am not the one that made the script and one that can make changes to it but i am looking for a solution within my options and possibilities.... wich is pretty limited in this case.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.