Jump to content

jonoc33

Members
  • Posts

    151
  • Joined

  • Last visited

    Never

Contact Methods

  • MSN
    jonoc33@hotmail.com
  • Website URL
    http://www.webzelite.com.au

Profile Information

  • Gender
    Male

jonoc33's Achievements

Member

Member (2/5)

0

Reputation

  1. Hey guys! Haven't been here in a while but it's finally time I need help again. Heres the issue i'm having: I'm working for my Dad, making a new application called Traveller. They use web services to input data and get data. Web services so far have worked well for me. They output data perfectly and it's all worked fine. Now i'm up to the stage where I need to input data to a web service so that it can create a record. It uses ALOT of data. I'm talking: Notice how theres nested data or objects in there? Look at address_det, theres multiple address_details in that. At the moment it passes through all values fine, except for these nested objects. What i'm struggling with is being able to input multiple address detail objects inside address_det. Considering each object would have the same name its a bit hard to code that. Heres what i've got at the moment. $parameters = new Request(); $parameters->user_id = $_COOKIE['user_id']; $parameters->password = $_COOKIE['password']; $parameters->req_input = new ReqInput(); $parameters->req_input->request_id = 0; $parameters->req_input->request_description = $issue; $parameters->req_input->refer_no = $refno; $parameters->req_input->service_type = $service; $parameters->req_input->request_type = $request; $parameters->req_input->function_type = $function; $parameters->req_input->request_datetime = date("Y-m-d") . "T" . date("H:i:s"); $parameters->req_input->due_datetime = date("Y-m-d") . "T" . date("H:i:s"); $parameters->req_input->centre = 'WEB'; $parameters->req_input->how_received = 'WEB'; $parameters->req_input->input_by = $_COOKIE['responsible_code']; $customer_name_det = array( "name_id" => 0, "pref_title" => $cust_title, "given_names" => $cust_given, "surname" => $cust_surname, "mobile_no" => $cust_mobile, "telephone" => $cust_phone, "work_no" => $cust_work, "email_address" => $cust_email, "name_ctr" => 0, "company_name" => $cust_company ); $address_det = array( array( "address_id" => 0, "house_number" => $cust_address_number, "property_number" => $cust_address_fnumber, "street_name" => $cust_address_street, "street_type" => $cust_address_streettype, "locality" => $cust_address_suburb, "address_ctr" => 0, "address_desc" => $cust_address_desc ), array( "address_id" => 0, "house_number" => $loc_address_number, "property_number" => $loc_address_fnumber, "street_name" => $loc_address_street, "street_type" => $loc_address_streettype, "locality" => $loc_address_suburb, "address_ctr" => 0, "address_desc" => $loc_address_desc ) ); $parameters->req_input->customer_name_det->customer_name_details = $customer_name_det; $parameters->req_input->address_det->address_details = $address_det; $parameters->req_input->ws_status = 0; $parameters->req_input->ws_message = ''; $wsdl = WEB_SERVICES_PATH.MERIT_REQUEST_FILE."?wsdl"; try { $client = new SoapClient ($wsdl, array ("classmap" => array ("ws_create_request" => "Request"))); $result = $client->ws_create_request($parameters)->ws_create_requestResult; } catch (Exception $e) { echo $e -> getMessage (); } Notice where I have the $customer_name_det and $address_det variables. They're the ones that are nested as you'll see in the web service sample. I've tried putting each into an array and then just setting customer_name_det->customer_name_details to that array variable (and address_det->address_details as well ), but when passed through that fails to work as well. How should I input data into these nested objects in a web service?
  2. Check the MySQL connection settings, thats why it comes up with those errors.
  3. Hi guys, I have made an update platform which auto generates a ZIP file from a folder's contents, using Rochak Chauhan's ZIP file creation tool along with an extended class to auto-find all of the files and folders automatically to add to the zip. The ZIP makes itself ok. <? session_start(); require_once("zipfile.php"); $createZip = new createDirZip; $createZip->addDirectory(''); $createZip->get_files_from_folder('../development/', ''); // gets all files and folders from the development folder $fileName = 'zip/zipfile-'.mysql_real_escape_string(htmlentities($_POST['version'])).'.zip'; $fd = fopen ($fileName, 'wb'); $out = fwrite ($fd, $createZip->getZippedfile()); fclose ($fd); ?> Now, I have another application i've made which checks for updates, and uses the ZIP to unzip itself and overwrite everything to basically update the whole thing. <? include("inc/php/config.php"); // Functions to be used function unzip($src_file, $dest_dir, $create_zip_name_dir=false, $overwrite=true) { if (is_resource($zip = zip_open($src_file))) { $splitter = ($create_zip_name_dir === true) ? "." : "/"; if ($dest_dir === false) $dest_dir = substr($src_file, 0, strrpos($src_file, $splitter))."/"; // Create the directories to the destination dir if they don't already exist create_dirs($dest_dir); // For every file in the zip-packet while ($zip_entry = zip_read($zip){ { // Now we're going to create the directories in the destination directories // If the file is not in the root dir $pos_last_slash = strrpos(zip_entry_name($zip_entry), "/"); if ($pos_last_slash !== false) { // Create the directory where the zip-entry should be saved (with a "/" at the end) create_dirs($dest_dir.substr(zip_entry_name($zip_entry), 0, $pos_last_slash+1)); } // Open the entry if (zip_entry_open($zip,$zip_entry,"r")) { // The name of the file to save on the disk $file_name = $dest_dir.zip_entry_name($zip_entry); // Check if the files should be overwritten or not if ($overwrite === true || $overwrite === false && !is_file($file_name)) { // Get the content of the zip entry $fstream = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)); if(!is_dir($file_name)) file_put_contents($file_name, $fstream ); } // Close the entry zip_entry_close($zip_entry); } } // Close the zip-file zip_close($zip); } else { echo "No Zip Archive Found."; return false; } return true; } else { if(version_compare(phpversion(), "5.2.0", "<")) $infoVersion="(use PHP 5.2.0 or later)"; echo "You need to install/enable the php_zip.dll extension $infoVersion"; } } function create_dirs($path) { if (!is_dir($path)) { $directory_path = ""; $directories = explode("/",$path); array_pop($directories); foreach($directories as $directory) { $directory_path .= $directory."/"; if (!is_dir($directory_path)) { mkdir($directory_path); } } } } $current = $_POST['version']; $con = mysql_connect("host", "user", "pass"); mysql_select_db("updateplatform_zipfile", $con); $dbQueryV = mysql_query("SELECT * FROM updateplatform_zipfile WHERE version > '".$current."' ORDER BY id ASC"); while($dbRowV = mysql_fetch_array($dbQueryV)){ $version = $dbRowV['version']; $file = file_get_contents("http://link.com/etc/zipfile/zipfile-".$version.".zip"); file_put_contents("zipfile-".$version.".zip", $file); $zip = "zipfile-".$version.".zip"; unzip($zip, "", false, true); unlink("zipfile-".$version.".zip"); } ?> Now the strange thing is, that when I make a ZIP MANUALLY by downloading all the "development" files and zipping them up through winrar then uploading them to the correct location all manually, that above script which unzips it and overwrites it all works. When it's ZIPped up all done automatically through the Update Platform I made it comes up with these errors. over and over again, hundreds of times, mostly due to it doing it for each file in the zip. I need help!!
  4. So there is no way of fixing the problem unless I have access to php.ini? I'm paying for a web hoster, so that won't be happening any time soon.
  5. I've made an upload form/script for one of my websites yet whenever I upload, $_FILES contains no data in it at all (i've done print_r($_FILES)). I've also done ini_set("upload_file_maxsize", "10M"); AND ini_set("post_file_maxsize", "10M"); to make sure that the max size of uploads doesn't mess it up. I know it's something to do with the size because if I upload a significantly smaller file it works. Any ideas?
  6. Hey guys, I'm making a Project Management System and want to know if it's possible to make a Dynamic PHP Gantt Chart. Basically you fill in all the information and it would automatically create an image on the following page that you can save to your PC. I know this is slightly possible due to the fact that you can use the ImageCreate or Image functions to do so in some cases. Anyone got any ideas? Jono
  7. Say if I had a variable: $rank = "Fighters"; How would I get retrieve the last letter?
  8. How exactly do I do that? Also, for some reason my site is running incredibly slow now that i've added this to the .htaccess. Any reason why?
  9. No advantages, just makes it cleaner. Although several problems emerge. Making the images direct links still doesn't work.
  10. Anyone else know how to set this up? I searched PHP virtual directory on google and that relates to what my question is. It has something to do with modifying your .htaccess file.
  11. I didn't really mean it like that. That's really basic stuff. Say I have this link: http://www.site.com/index.php?page=home I want to make it this: http://www.site.com/home/ But it's like a virtual folder, the folder isn't actually on the server.
×
×
  • 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.