
refiking
Members-
Posts
500 -
Joined
-
Last visited
Everything posted by refiking
-
I have a script that retrieves USPS parcel options for purchases and I'm pasting the relevant code here: $body = ''; $http = new httpClient(); if ($http->Connect('production.shippingapis.com', 80)) { $http->addHeader('Host', 'production.shippingapis.com'); $http->addHeader('User-Agent', 'osCommerce'); $http->addHeader('Connection', 'Close'); if ($http->Get('/shippingapi.dll?' . $request)) $body = preg_replace(array('/\<sup\>\®\<\/sup\>/', '/\<sup\>\™\<\/sup\>/', '/\" /', '/\",/', '/\"<br>/', '/<br>/'), array('RM', 'TM', '",', '" ', '"<br>', 'BREAK'), htmlspecialchars_decode($http->getBody())); $http->Disconnect(); echo '<pre>'; print_r($body); echo '</pre>'; return json_decode(json_encode(simplexml_load_string($body)),TRUE); } This used to work a few months back. Not sure what changed, but now I get an error result (3xxxxx is the account number obviously). I added the pre - $body - pre line recently to try to figure out what is wrong with it. 3xxxxxxxxxVARIABLEREGULAR1Media Mail<sup>®</sup>2.539Certificate of Mailingtruefalse1.2001Insurancetruefalse1.950truefalse13USPS Tracking<sup>™</sup>truetrue0.900.207Return Receipt for Merchandisetruefalse4.10015Signature Confirmation<sup>™</sup>truetrue2.702.206Collect on Deliverytruefalse6.450truetrue305283015710VARIABLEREGULAR1Priority Mail 1-Day<sup>™</sup>5.605.059Certificate of Mailingtruefalse1.2001Insurancetruetrue1.951.95truefalse5Registered Mail<sup>™</sup>truefalse11.200truefalse4Registered without Insurancetruefalse11.2000Certified Mail<sup>®</sup>truefalse3.10013USPS Tracking<sup>™</sup>truetrue0.000.007Return Receipt for Merchandisetruefalse4.10015Signature Confirmation<sup>™</sup>truetrue2.702.2019Adult Signature Requiredfalsetrue04.9520Adult Signature Restricted Deliveryfalsetrue05.156Collect on Deliverytruefalse6.450truetrue Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : String not closed expecting " or ' in /home/xxx/public_html/store/includes/modules/shipping/usps.php on line 297 Warning: simplexml_load_string() [function.simplexml-load-string]: <?xml version="1.0",encoding="UTF-8"?> in /home/xxx/public_html/store/includes/modules/shipping/usps.php on line 297 Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /home/xxx/public_html/store/includes/modules/shipping/usps.php on line 297 Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Blank needed here in /home/xxx/public_html/store/includes/modules/shipping/usps.php on line 297 Warning: simplexml_load_string() [function.simplexml-load-string]: <?xml version="1.0",encoding="UTF-8"?> in /home/xxx/public_html/store/includes/modules/shipping/usps.php on line 297 Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /home/xxx/public_html/store/includes/modules/shipping/usps.php on line 297 Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : parsing XML declaration: '?>' expected in /home/xxx/public_html/store/includes/modules/shipping/usps.php on line 297 Warning: simplexml_load_string() [function.simplexml-load-string]: <?xml version="1.0",encoding="UTF-8"?> in /home/xxx/public_html/store/includes/modules/shipping/usps.php on line 297 Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /home/xxx/public_html/store/includes/modules/shipping/usps.php on line 297
-
I've tried several ways and none of them are working, which means I'm missing something extremely simple. Can you guys point me in the right direction here? $lines = array('description'=>$desc1,'qty'=>$qty1,'rate'=>'11.70'); $lines[] = array('description'=>$desc2,'qty'=>$qty2,'rate'=>'13.25'); $line_items = array($lines);
-
I'd figured out the issue (probably while you were posting). Had to str_replace the slashes.....sheesh I hate missing the ones staring me in the face!
-
I can't figure this out for anything! I'm trying to convert a date (m-d-Y) to (Y-m-d H:i:s) prior to db entry. Here's the code: $date_added = date('Y-m-d 00:00:00', strtotime($_POST['date_added'])); echo $date_added; echo'<hr>'; echo $_POST['date_added']; exit;
-
What you wrote gave me an idea. Here is what I am trying to do basically... $files = array(); if($postfiles['file1'] == 1){ $files[] = array('name'=>'file1','title'=>'file1', 'path' => 'file1.msi'); } if($postfiles['file2'] == 1){ $files[] = array('name'=>'file2', 'title'=>'file 2', 'path' => 'file2.msi'); }
-
Oops. I meant to enclose the code block $postfiles = $_POST;[/font][/color] if($postfiles['file1'] == 1){ [/font][/color] $arrayme .= "array('name'=>'file1','title'=>'file1', 'path' => 'file1.msi'),";[/font][/color] }[/font][/color] if($postfiles['file2'] == 1){ [/font][/color] $arrayme .= "array('name'=>'file2', 'title'=>'file2', 'path' => 'file2.msi'),";[/font][/color] }[/font][/color] $files = array([/font][/color] $arrayme,[/font][/color] );
-
I'm working on a zip archive script that works if I have no conditions. The second I check it against teh post data and try to render out a line, it doesn't work anymore. Not sure what I'm doing wrong. Here is the code with no conditions: $files = array( array('name'=>'file1', 'title'=>'file1', 'path' => 'file1.msi'), array('name'=>'file2','title'=>'file2', 'path' => 'file2.msi'), ); Here is what I'm trying to do: $postfiles = $_POST; if($postfiles['file1'] == 1){ $arrayme .= "array('name'=>'file1','title'=>'file1', 'path' => 'file1.msi'),"; } if($postfiles['file2'] == 1){ $arrayme .= "array('name'=>'file2', 'title'=>'file2', 'path' => 'file2.msi'),"; } $files = array( $arrayme, ); [code]
-
I'm looking to extract the following: SDX, telephone number, opsys, physical memory size, c drive size, and physical address Timmy Cramer SDX6052 TEL 5207426818 System Information -------------------------------------------------------------------------------------------- OPSYS Windows 7 Home Premium x64 Edition 6.1 (build: 7601) Service Pack 1 BIOS Version HPQOEM - 1 Last booted 9/15/2012 1:45 PM Computer Name OWNER-HP Computer Description owner-HP Interactive User owner-HP\owner Default Browser Internet Explorer Default Browser Path C:\Program Files (x86)\Internet Explorer\iexplore.exe Default Browser Version 9.00.8112.16448 Device screen 1024 x 768 x 32 CPU Information ----------------------------------------------------- CPU Name AMD CPU Clock 1497 MHz CPU Description Number 4 Level 18 Model 1 Stepping 0 CPU Usage 27% Memory Information ------------------------------- Physical Memory Size 3.47 GB Physical Memory Used 1.75 GB Physical Memory Used % 50% Physical Memory Free 1.72 GB Physical Memory Free % 49% Commit Memory Size 6.95 GB Commit Memory Used 2.37 GB Commit Memory Used % 34% Commit Memory Free 4.57 GB Commit Memory Free % 65% Disk Drives Drive Size Free % in use ------------------------------------- C:\ 441.51 GB 390.39 GB 12% D:\ 20.08 GB 2.17 GB 90% E:\ 3.95 GB 1.08 GB 73% F:\ 0% G:\ 0% Q:\ 0% Processes (Top 5 per CPU) Name CPU% Memory ------------------------------------ System Idle Process 73% iexplore.exe 9% 337.43 MB LMI_Rescue_srv.exe 3% 79.74 MB iexplore.exe 3% 287.75 MB System 2% Events (Last 5 Errors) Type Generated Source Event ID --------------------------------------------------------------- 9/15/2012 6:48 PM Microsoft-Windows-DNS-Client 1014 9/15/2012 6:29 PM Microsoft-Windows-DNS-Client 1014 9/15/2012 5:57 PM Microsoft-Windows-DNS-Client 1014 9/15/2012 5:15 PM VSS 12348 9/15/2012 2:58 PM CVHSVC 100 Scheduled Tasks (Last 5) Name Last run Next run Status Connection-specific DNS Suffix: mifi.local Description: Atheros AR9485 802.11b/g/n WiFi Adapter Physical Address: XX-XX-XX-XX-XX-XX DHCP Enabled: Yes IPv4 Address: 192.168.1.2 IPv4 Subnet Mask: 255.255.255.0 Lease Obtained: Saturday, September 15, 2012 5:15:20 PM Lease Expires: Sunday, September 16, 2012 5:15:20 PM IPv4 Default Gateway: 192.168.1.1 IPv4 DHCP Server: 192.168.1.1 IPv4 DNS Server: 192.168.1.1 IPv4 WINS Server: NetBIOS over Tcpip Enabled: Yes IPv6 Address: xxxxxxxxxx:2095 Temporary IPv6 Address: xxxxxxxx:6086:9f44 Link-local IPv6 Address: xxxxxxx:2095%13 IPv6 Default Gateway: xxxxxxxxxxxxx:507%13 IPv6 DNS Servers: 2001: xxxxxxxxxxxxxxxx:a0:d:0:3
-
Honestly, I'm not sure exactly what approach I need to take. I know for example there is the SDX id. i don't know how to do a search for only that SDX. Then, there's OPSYS ($ops). It has OPY and then a space and then the operating system, but it also contains the build info that I wouldn't want, everything before it, though. What would you recommend I use for pulling out the variables I need? Remember, there might be things before and after it that I wouldn't want to be a part of the value. @psycho...There are line breaks throughout the text, but not between the variable where the values are located.
-
So, I have a text file snippet that is entered into a textarea and upon submission, I'd like to search and define (if applicable) certain variables. For example, if SDT is present, I'd like to assign the $sdt variable. My problem is I don't know how to explode even if I'm supposed to explode it. There are about 8 different variables I need to search for and I don't want to screw it up by exploding too many times or something.
-
So, here's the problem. I wrote a code that opens a div based on the selected dropdown. That works great. I then wanted to preselect a specific option ($_POST['value']). That works great. The problem comes in when I also want to have the correlating div to open as well. I can do one or the other, but never both together. Please show me what I'm supposed to do: var theText = "Printer Setup"; //$("#sow option:contains(" + theText + ")").attr('selected', 'selected'); $("#sow option:contains(" + theText + ")").attr('selected', 'selected')$('#divoption5').show();
-
I am trying to take a value that is stored in a db for address and parse it into 4 different variables: $address $city $state $zip when I started the loop and echo'd the results, here is how it comes out: a:4:{s:14:"street_address";s:20:"811 East Parrish Ave";s:4:"city";s:9:"Owensboro";s:5:"state";s:2:"KY";s:3:"zip";s:5:"42303";} a:4:{s:14:"street_address";b:0;s:4:"city";b:0;s:5:"state";b:0;s:3:"zip";b:0;} a:4:{s:14:"street_address";s:15:"800 Rose Street";s:4:"city";s:9:"Lexington";s:5:"state";s:2:"KY";s:3:"zip";s:5:"40536";} a:4:{s:14:"street_address";s:19:"1300 State Hwy 3298";s:4:"city";s:10:"Olive Hill";s:5:"state";s:2:"KY";s:3:"zip";s:5:"41164";} a:4:{s:14:"street_address";s:22:"1301 North Race Street";s:4:"city";s:7:"Glasgow";s:5:"state";s:2:"KY";s:3:"zip";s:5:"42141";} a:4:{s:14:"street_address";s:23:"200 Abraham Flexner Way";s:4:"city";s:10:"Louisville";s:5:"state";s:2:"KY";s:3:"zip";s:5:"40202";}
-
bump...any takers?
-
ohhhh..sorry <? class OrderForm extends BaseOrderForm { static protected $choices = array(1 => 'OPEN',2 => 'CLOSED'); static public function getStatusChoices() { return self::$choices; } public function configure() { $years = range(2009, 2012); //Creates array of years between 2009-2012 $years_list = array_combine($years, $years); //Creates new array where key and value are both values from $years list $koid = $this->object; echo '<pre>'; print_r($koid); echo '</pre>'; $this->setWidgets(array( 'id' => new sfWidgetFormInputHidden(), 'stand_by' => new sfWidgetFormInput(array('label' => ' Stand By')), 'problem' => new sfWidgetFormInput(array('label' => ' Problem')), )); $this->setValidators(array( 'id' => new sfValidatorPropelChoice(array('model' => 'Order', 'column' => 'id', 'required' => false)), 'stand_by' => new sfValidatorString(array('max_length' => 5, 'required' => false)), 'problem' => new sfValidatorString(array('max_length' => 50, 'required' => false)), )); } }
-
What are you talking about? That is my actual code... Same variables and same results exactly. I don't set the id. I am just trying to retrieve it, so I don't create the object.
-
Ok, so what do I need to do to retrieve the id?
-
That didn't work. I also tried this and it didn't work either: $koid = $this->object['id']; echo '<pre>'; print_r($koid); echo '</pre>';
-
Ok. So, I'm trying to retrieve the id value from an object. Here is the code I have that works so far: $object = 'object'; $koid = $this->$object; echo '<pre>'; print_r($koid); echo '</pre>'; and this is what is returns: Order Object ( [id:protected] => 5 [stand_by:protected] => test [problem:protected] => test ) what do I need to do to make $koid equal the id value (5 in this case)?
-
Array ( [var1] => testing ) Warning: Unknown: open(C:\Windows\Temp\sess_akcd20pu86q7mvn2tdfahltja2, O_RDWR) failed: Permission denied (13) in Unknown on line 0 Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (C:\Windows\Temp) in Unknown on line 0 How can I set the session folder to a directory that I create?
-
I have a script that was written and tested on another server, but now when I transferred it to the live server, session values are not being passed. I made a couple test pages to check and confirmed that the only issue is the session variables. Here is the test I performed. Please tell me what I'm missing: page1.php <? session_start(); $_SESSION['var1'] = 'testing'; print_r($_SESSION); ?> Returns: Array ( [var1] => testing ) page2.php <? session_start(); print_r($_SESSION); ?> Returns: Array ()
-
Should I try to split this up into a new function or something? I'm lost. When I go through the process and select zip code, it prompts me to enter my zip code, but I can't click continue. If I need to make it a new function, can you show me how and where I should implement it? <script type="text/javascript"> function findstore(){ var txt = 'Step 1: Select your store by:<br><input type="radio" name="type" value="dropdown"> Dropdown Menu<br><input type="radio" name="type" value="zipcode"> Zip Code Search'; $.prompt(txt,{ buttons:{'Confirm':true, 'Cancel':false}, submit: function(v,m,f){ var flag = true; if (v) { } return flag; }, callback: function(v,m,f){ if(v){ if(f.type == 'dropdown'){ document.getElementById('demo').innerHTML = '<table align="center"><tr><td><img src="images/ajax-loader.gif"></td></tr></table>'; var type = f.type; $.post('findstore.php',{type:type}, function(data){ $("div#demo").html(data); } ); } if(f.type == 'zipcode'){ var txt = 'Step 2: Enter your zipcode: <input type="text" name="zip"'; $.prompt(txt,{ buttons:{'Confirm':true, 'Cancel':false}, submit: function(v,m,f){ var flag = true; if (v) { } return flag; }, callback: function(v,m,f){ if(v){ $.post('findstore.php',{type:'zipcode',zip:c.zipcode}, function(data){ $("div#demo").html(data); } ); } } }); } } } }); } </script>
-
-
I only want to check the array where name => state
-
I don't have access to the script that defines the array. What I want to do is add a conditional statement that if the array contains the state, to change the visible variable to 0. How can I do that?
-
Array ( [0] => Array ( [id] => 9 [type] => text [ordering] => 13 [published] => 1 [min] => 10 [max] => 100 [name] => State [tips] => Your state [visible] => 1 [required] => 1 [searchable] => 1 [registration] => 1 [options] => [fieldcode] => FIELD_STATE [params] => [value] => florida [access] => 0 [searchLink] => /index.php/field?FIELD_STATE=florida ) [1] => Array ( [id] => 10 [type] => text [ordering] => 14 [published] => 1 [min] => 10 [max] => 100 [name] => City / Town [tips] => Your city or town name [visible] => 1 [required] => 1 [searchable] => 1 [registration] => 1 [options] => [fieldcode] => FIELD_CITY [params] => [value] => palm harbor [access] => 0 [searchLink] => /index.php/field?FIELD_CITY=palm+harbor ) )