Jump to content

RabPHP

Members
  • Posts

    38
  • Joined

  • Last visited

    Never

Everything posted by RabPHP

  1. Greetings, I know nothing about PHP Web services or SOAP. I have a vendor who needs me to package an XML file as an object in what I am assuming is a SOAP transaction using cURL but do not have the foggiest isea where to begin. Advice appreciated. Rab
  2. I have a web application which integrates with a locally installed application. For this integration to work I need to write a file to a specific directory on the computer that is viewing the website. I know there are security issues with this however I can lock it down to only allow 1 site to access this directory through typical windows applications. I am looking for ideas on how to do this as I have tried changing permissions, creating shares and so far nothing has worked. I have even tried installing IIS on the local PC and accessing the file through http://localhost however that returns: Warning: fopen(http://localhost/test.xml) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections Any advise appreciated.
  3. Those portions of the string contining a 1 or a 2 are uniform, I simple did a str_replace before subjecting your code on the string and it resolved the problem. Much appreciated! Rab
  4. Ok one more final addition. Sometimes there is a number outside of the parenthesis, it's always either a 1 or a 2. How do I strip off the first character if it's a 1 or 2? Rab
  5. Greetings, I have a variable that looks like "THISISSOME(2 EXTREMELY)RANDOMDATA12345AP" I need to strip out the random data and return everything after the first occurance of a number that is not inside a parenthesis. In this example, I want to only get 12345AP. The data may be random wordsand characters without a defined length. This one has me baffled but I know it's possible, please advise! Thanks Rab
  6. Greetings, I have an HTML which I open and read. I need to convert the HTML tags to RTF tags. I am looking for some sort of HTML to RTF converter code or class. Anyone know where one can be found? RabPHP
  7. What if I were to install PHP and IIS on the WXP box then lock it down to only allow http connections from a specific IP. I can have the remote site call http://localhost/do_integration.php which would launch local php script that writes the file? Is that really my only option? Rab
  8. Thats why I imaging either an activeX install or something. I've seen it done on other links where once you click on a link it launches a locall installed program of sorts. Just looking for a direction to start researching. Thanks. Dan
  9. Greetings, I am developing a web based application which interfaces with another application by writing an XML file to the local PC when they click on a specific link. I am not sure how to do this but it may require some sort of ActiveX install. Anyone with any ideas to point me in the right direction? Rab
  10. Ultimately I am trying to take this data out of a huge text file that I can't control the output. If this field were enclosed with quotes is there a function or something in PHP that I can use specifically for this field? I am looking for some sort of insight into how I can make this work. Thanks for your help. Rab
  11. Hey Guys, I have a text file that is deliminated by either Semi-Colons or Pipes. I am using this function to read them and put into an array: $readfile = file("testimport1.txt"); for ($k=0; $k<=count($readfile)-1; $k++) { $fields = split(";",$readfile[$k]); One of the fields is a description containing several paragraphs. I find that this function will not recognize that the description is between semi-colons or Pipes and counts each new line in that field as a new record. Is there anyway to get around this? Rab
  12. Thanks! Very interesting way of looking at it the way PHP does, great insight. Rab
  13. Greetings, Here is an issue I am running into. I have an XML that looks like the following: <Query> <Patient> <Study> <PatientID>1145566</PatientID> <StudyCode>x333333</StudyCode> </Study> <Study> <PatientID>1145566</PatientID> <StudyCode>x222222</StudyCode> </Study> </Patient> <Patient> <Study> <PatientID>1145566</PatientID> <StudyCode>x4444444</StudyCode> </Study> <Study> <PatientID>1145566</PatientID> <StudyCode>x6666666</StudyCode> </Study> <Study> <PatientID>1145566</PatientID> <StudyCode>x55555555</StudyCode> </Study> </Patient> </Query> My Code looks like the following: $PAT_ID = '1145566'; $xmlstring = file_get_contents("patients.xml"); $xml = new SimpleXMLElement($xmlstring); foreach ($xml->Patient as $Patient) { if (strtolower($Patient->Study->PatientID) == "$PAT_ID") { $sid = $Patient->Study->StudyCode . "</p>"; echo($sid); } } When I do this, I only get the first StudyCode for each Patient. I would like to get the StudyCodes for Each Study. The PatientID in the file will always be the same, therefore I don't need that to actually be the qualifyier. I just want to get the StudyCode for each Patient and set it as a variable. I am really stumped, but know that I need to not just loop through patients but also loop through the Studies. I am bad with nested loops, please advise if anyone can help. Rab
  14. Greetings, I need to write a script which will pass paramters to another web page which will then return an XML result. I then loop through the XML data to get the relevant data and use that data to reform some Links. I need some guidance on a few items. 1) The script is password protected with a password, how can I auto-authenticate and pass a username and password to the browser automatically? This script will run on the backend so there will be no user involvement. 2) Once I am authenticated, can I simply use fopen to get this page? 3) If yes to the above, can I then use simpleXML() to loop through the data to find the relevant pieces? Any ideas greatly appreciated.
  15. This works perfectly and allows me to seperate everything out nice and neat, thanks! Rab
  16. Greetings all, I have to write a file format that requires some very specific data in specific positions on specific lines. For example... I have a list of data with the following requirements: First Name (Line 1 position 1) Last Name (Line 1 position 45) Street Address (Line 2 Position 1) City (Line 2 position 40) State (Line 2 position 55) Zip (Line 2 Position 58) Phone Number (Line 3 Position 1) Fax Number (Line 3 Position 11) I have tried a combination of fputs, fseek however fseek keeps going back to the first line. This will be a new file each time therefore the lines do not exist yet to put into an array. Any advise greatly appreciated. Rab
  17. If your writing this from a webpage, make sure that the user Apache runs under has write permissions on songs.dat. In your shell, type $chown apache.apache songs.dat As for the code itself... Try.. [code]                                <?php                 //Get form data values                         $title = "Test";                         $composer = "Test2";                         $performer = "Test3";                 //Generate data to be written to the data file                 $data = "Song:  " . $title . "\n" . "Composer:  " . $composer ."\n" . "Artist/Group:  " . $performer . "\n\n\n";                 //Open a file and write the results to it                 $file = fopen("songs.dat", "a+")                                 or die ("ERROR - songs.dat cannot be opened");                 $bytes_written = fwrite($file, $data);                 fclose($file);                 ?> [/code] Substituting (.) for (+) Rab
  18. Thorpe, your a genius.  Thanks for the help, I'll study these two new functions, I've never seen nl2br before. Rab
  19. That worked!  I've been trying to do this myself for almost a week. Only 1 small problem.  The XML file has a New Line after the entries in the description.  For example... <description>description of Story1 This is a cool movie This gets 5 stars </description> With the code below it's displaying... description of Story1 This is a cool movie This gets 5 stars How can I get it to take the New Line markers and display it on a new line? Rab
  20. I've been looking over the SimpleXML function, however I can't seem to find any examples of what I am looking for. I have found out how to pull out everything in a specific node, but not how to pull out information in a node where another node on the same level equals something.  Anyone out there have an example? Rab Rab
  21. Greetings, I need to know if it is possible to query an XML file for something specific. For example... I have an XML data that looks like... <news> <story> <headline>Story1</headline> <description>description of Story1 </description> </story> <story> <headline>Story2</headline> <description>Description of Story2</description> </story> </news> What I would like to do is essentially "SELECT description from (file) where headline='story2'; Is there anyway to do something like that with PHP and XML? Rab
  22. I appreciate the help mjdamato.  I've been working with your suggestion for the past couple of days and have not been able to get it to work.  I've changed how I'm exporting the data in those attempts to try and simplify. Here is a real example of the data now... 121222;10/05/2006 8:37AM - Notes for this loan are in the 1st file- John Doe|121223;11/02/2006 8:41PM - was told would have UW update today by asst--still didn't receive--phoned the UW--she left at 4:00-sent an email to her and the asst asking for update--told we are trying to close next week and needed an uw update on Friday urgently. Will follow up again on Friday. - John Doe 11/01/2006 11:09PM - no updates from UW yet on items sent over--will follow up on Thursday. - John Doe|121224; 11/04/2006 10:14AM Notes for this loan are in the 2nd File file- John Doe| Here you can see the following... Records are seperated by PIPE "|" Fields are seperated by Semi-Colon Entries in the last field are seperated by a New Line if there are more then 1 entry. I can explode the records seperated by a | without a problem, but then how do I explode the parts in the record by a semi-colon and then in the last field, by a new line if one is present? I'm in a pickle, if anyone can help please let me know. Rab
  23. I am pulling the data from a text file and then updating the appropriate records in MySQL.
  24. The problem is differentiating bewteeen a new line.  Here is some example data. Joe;Smith;09/07/06; 10/15/06 - Some Entry 10/15/06 - another entry 10/16/06 - Third Entry Log; Jane;Doe;09/08/08; 10/12/06 - Some Entry 10/12/06 - another entry; After the first name and lastname there is date.  PHP sees this as the end of the record because of the new line even though the entries after them belong to the same record.  I cannot remove the returns in the last field, because PHP thinks they are new lines, not just a field. Anyone have an example of how to parse text files with text qualifiers? For example.. "Joe";"Smith";"09/07/06;" "10/15/06 - Some Entry 10/15/06 - another entry 10/16/06 - Third Entry Log"; "Jane";"Doe";"09/08/08"; "10/12/06 - Some Entry 10/12/06 - another entry"; Help appreciated.  Thanks Rab
  25. Greetings, I have a tough issue.  I use text files extensively to read data and then enter it into MySQL.  I use semi-colons for field delimination and then typically a new line between records. Recently I found that I also need to add another field to one of the text files, but this field has hard returns in it.  This causes PHP to read each return in this field as a new line and thus a separate record I believe I either need to figure out how to specify the record ending delimiter or use text qualifiers.  Does anyone have any information on either of these? Rab
×
×
  • 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.