Jump to content

Nodral

Members
  • Posts

    397
  • Joined

  • Last visited

Everything posted by Nodral

  1. Morning All I'm in the process of creating an email app, and I'm having an issue extracting anything useful from a certain email. 99.99% of emails received work absolutely fine, however I cannot get any content from one. The structure returned from $structure = imap_fetchstructure($MailboxConnection, $email_number, 0); is object(stdClass)#5 (11) { ["type"]=> int(1) ["encoding"]=> int(0) ["ifsubtype"]=> int(1) ["subtype"]=> string(5) "MIXED" ["ifdescription"]=> int(0) ["ifid"]=> int(0) ["ifdisposition"]=> int(0) ["ifdparameters"]=> int(0) ["ifparameters"]=> int(1) ["parameters"]=> array(1) { [0]=> object(stdClass)#6 (2) { ["attribute"]=> string( "boundary" ["value"]=> string(33) "--_com.android.email_313497894392" } } ["parts"]=> array(1) { [0]=> object(stdClass)#7 (12) { ["type"]=> int(0) ["encoding"]=> int(3) ["ifsubtype"]=> int(1) ["subtype"]=> string(4) "HTML" ["ifdescription"]=> int(0) ["ifid"]=> int(0) ["lines"]=> int(26) ["bytes"]=> int(2068) ["ifdisposition"]=> int(0) ["ifdparameters"]=> int(0) ["ifparameters"]=> int(1) ["parameters"]=> array(1) { [0]=> object(stdClass)#8 (2) { ["attribute"]=> string(7) "charset" ["value"]=> string(5) "utf-8" } } } }} Which part should I extract with $data = imap_fetchbody($MailboxConnection, $email_number, '????'); Been on this for a while now, and getting nowhere fast so any help would be greatly appreciated. I've read the documentation, but it doesn't go into detail of identifying what part can be identified and extracted from the stucture information.
  2. Hi All I have a screen which opens a jquery modal window (from jquery ui). This contains a div, which I need to populate via ajax. I have a fully working ajax function and can see the data being returned from the server. However I cannot get this to go into a div on the modal window. Any thoughts? I thought maybe it was running the ajax prior to the modal window opening and therefore cannot find the div to populate. I've tried alsorts, but cannot get this to work. Any ideas guys? $("#manualDialog").dialog({ resizable: false, autoOpen:false, modal: true, width:1000, height:800, open: function(){ getImages(worktype,'manualimages'); //function for getting the data from ajax }, buttons: { 'Continue': function() { $(this).dialog('close'); var plaincontentlength=0; var htmlcontentlength=0 var defContent=$('#manualdefaultemailplain').val(); var defHTMLContent=$('#manualdefaultemailhtml').val(); var htmlcontent=$('#manualhtmlinput').val(); var plaincontent=$('#manualplaininput').val(); if(defContent==0){ plaincontentlength=plaincontent.length; $('#manualplainsubmit').val(plaincontent); }else{ $('#manualplainsubmit').val(''); } if(defHTMLContent==0){ $('#manualhtmlsubmit').val(htmlcontent); htmlcontentlength=htmlcontent.length; }else{ $('#manualhtmlsubmit').val(''); } var overridelength=plaincontentlength+htmlcontentlength; if(overridelength >0){ $('#manualyes').show(); $('#manualno').hide(); }else{ $('#manualyes').hide(); $('#manualno').show(); } } }//end buttons });//end dialog function getImages(worktype,div){ ajaxGet('worktypes.php?ajax=yes&worktype='+worktype,getImageCallback) } function getImageCallback(result){ $('#manualimages').html(result); }
  3. You may want to check your spelling of the function in this line too Childish I know, but made me chuckle
  4. Check that your mysql server hasn't set up an anonymous user (''@localhost). This had me flumoxxed for ages.
  5. Nodral

    Hello

    mysql_affected_rows returns nothing on a select as nothing is 'affected' / changed. You want mysql_num_rows as this is the amount of rows returned by the previous sql statement. Try this $this->query = "SELECT hexnum FROM $this->tablename"; $this->result = mysql_query($this->query); if (mysql_num_rows]() > 0 )
  6. try this $i=1; while($row = sqlsrv_fetch_array( $result,SQLSRV_FETCH_ASSOC)){ if($i=1){ echo "<tr style='background-color:".$color1.">"; $i++; }else{ echo "<tr style='background-color:".$color2.">"; $i=1; } foreach($fields as $key=>$not_used) { echo "<td>$row[$key]</td>"; } echo "</tr>\n"; dirty, but works
  7. Hi All I am trying to read in some emails using the various functions within the PHP/IMAP library and all's going well. UNTIL I have to deal with an 'Alternative' type email. I cannot get the following to seperate the plain text part out. it's almost as if the MIMe boundary's are being ignored. Any thoughts anyone? Cheers
  8. so how would I use mklink to go from to , as the colon is not a valid character within a file path
  9. I have approx 50 sites set up on the server, and each uses one of 3 common config files. Therefore we dyamically change the include path to point at the relevant config file. This is fine for the Linux developer guys, as they can just recreate the file structure on their machines, however I have an issue with the Windows guys as when they copy the files, their include paths break, and I really don't fancy going through everything and changing the include path settings to an 'if' statement. I'd rather just change the php settings on 3 machines if possible. If there's a way to do this, I'd be much appreciative. If not within the php.ini, whether I can do some sort of dynamic redirect solely on the Windows machines (like a symbolic link on linux) without amending the site files.
  10. Can this be referenced in the php.ini as I really don't want to be adding loads of if statements to my files
  11. I am currently installing a subversion protocol within a business, some of the users develop in Windows on local Wamp servers, and others use local Lamp servers. The main site runs on a linux server. The issue I have is setting up the include paths within the php.ini file. As some of the live files change this setting on the fly, this is becoming a pain. The windows machines require a semi colon delimiter in the include paths, and the linux machines require a colon. Is there any way to change the configuration of the windows machines to use a colon as the include path delimiters?
  12. I now have However I am getting error Come on guys, I really need this one!! lol
  13. Hi All I'm a bit of a newbie to regex and am struggling with what seems like the most basic preg_replace. I need to validate numbers and remove anything non-numeric from a string. ie 4.5volts would become 4.5 -67 degrees would be -67 I have this however there can only be one minus and it must be at the start, and there can only be one decimal point. Any help is much appreciated.
  14. Morning all I have 2 multidimentional arrays, where theoretically they can continue to the nth dimension. Is there a way (without using a horrible recursive function) I can iterate through both arrays and only return values where the keys are the same but the values are different?
  15. Hi I have the following multidimensional array. array => [0] ([apples]=>5, [pears]=>3, [bananas]=>6) [1] ([apples]=>2, [pears]=>4, [bananas]=>1) [2] ([apples]=>8, [bananas]=>2) How can I iterate through it and produce one array with all the totals added up? eg array => [apples]=>15, [pears]=>7, [bananas]=>9 I've tried googling , but can't seem to find the right thing. Obviously these are example values, the arrays I'm using contain about 40 keys each, therefore this was easier to write / explain.
  16. Hi I'm creating a 3 page form, using information from an XML service. The steps are as follows Page 1. The user puts in some times / dates etc into page 1 and I fire off an XML request to get availabilities and details of all tickets available. Page 2. All options available are rendered for the user to choose which one they would specifically like. Page 3. The choice is confirmed and we then pass a booking ref to a basket. The issue I have is, I am building this for a 3rd party and have no access to a DB so I need to be able to hold all the data from the XML response requested in step 1, to be able to output the confirmation on step 3. What is the best way to hold this from steps 2 to 3? I have thought of hidden fields or possibly session variables, but there are about 15 XML fields for each returned option and I can sometimes get over 30 options returned. Your thoughts please guys.
  17. still get invalid argument, however, when I turn the slashes around, I get a failed to open stream 500 error
  18. http:\\www.########.com\###service\###xmlinterface.asmx Obviously the hashes would be filled in.
  19. Hi All I'm pretty new to this, and need a quick fix. Here's my code $post_data = array('xml' => $xml_str); $length = implode($post_data); $stream_options = array( 'http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded' . "\r\n" . "Content-Length: " . $length . "\r\n", 'content' => http_build_query($post_data))); $context = stream_context_create($stream_options); $response = file_get_contents($url, null, $context); I'm getting the following error with the file-get contents and I don't know where to start looking for answers. I've tried Google, but the main response is about https wrappers, which I'm not using. This is to go to a HTTP. Line 67 is the one starting $response..................
  20. I'd be looking to populate the boxes with a simple ajax call back to a php script, based on what is selected in the previous box. Do some Googling for it, it's pretty straight forward
  21. Hey Guys I've recently delved into the world of PHP and XML, and I can create an XML post to a service using cURL. How do I wait for / receive a response back to the page. The idea is that I am communicating with a 3rd party and I am using a booking for which send an availibility to request to their server. Any pointers / tutorials would be great. No code for you unfortunately, as I really don't know where to start with this.
  22. Technically I was right tho. What I had written would fail!!! lol Forgot about the curly braces!! oops
  23. And if you're specifying a varibale from an array you cannot use it within double quotes. eg "hello $array[1] " will fail 'hello'.$array[1] will work
  24. Ok, found what you mean. Now I have $value = preg_replace('/\W*/', '', $value); But I still get How can I strip the foreign characters off?
×
×
  • 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.