Jump to content

denoteone

Members
  • Posts

    383
  • Joined

  • Last visited

    Never

Everything posted by denoteone

  1. I got it. My ini_set("display_errors","2"); ERROR_REPORTING(E_ALL); was adding a notice to the header of the XSL style sheet. I removed it and it is working fine.
  2. Trying to use firebug to see what is going wrong since I am only getting the XSLT error and no php error.
  3. Ok so I am calling the same page to set the .XSL style sheet but am getting the dreaded "Error loading stylesheet: Parsing an XSLT stylesheet failed." so the url calls the script that gets the xml file based on the GET variable and it adds the style sheet by calling the same page with a new GET variable. below is my script is this possible? <?PHP ini_set("display_errors","2"); ERROR_REPORTING(E_ALL); header('Content-type: text/xml'); $view = $_GET['view']; if(isset($_GET['xsl_style'])) { $style = '<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <h2>My CD Collection</h2> <table border="1"> <tr bgcolor="#9acd32"> <th>Title</th> <th>Artist</th> </tr> <xsl:for-each select="catalog/cd"> <tr> <td><xsl:value-of select="title"/></td> <td><xsl:value-of select="artist"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>'; echo $style; }else{ $xml_data = "http://www.website.com/STRATA/" . $view .".xml"; $handle = fopen($xml_data, 'r'); $Data = fread($handle, 10000); fclose($handle); $old ='<?xml version="1.0" encoding="ISO-8859-1"?>'; $new ='<?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet href="http://www.website.com/STRATA/get_view.php?xsl_style='. $view .'" type="text/xsl"?>'; $final_xml = str_replace($old, $new, $Data); echo $final_xml; } ?>
  4. ok I wasnt setting the header header('Content-type: text/xml');
  5. My variable which should be storing XML data and echos it to the screen is echoing the data as a string without the XML structure Below is my code but it is still not working: $view = $_GET['view']; $xml_data = "http://www.website.com/STRATA/" . $view .".xml"; $handle = fopen($xml_data, 'r'); $Data = fread($handle, 10000); fclose($handle); echo $Data;
  6. Technically that should work right? I mean all its doing is calling the same script twice. Then I can break the script up with an if statement based on the GET variable. Does that sound right?
  7. Trying to get everything in one file. I have an external data source that has 3 different XML files located on it. I am writing a php script that sits on my server and based on the GET variable I want to read a specific XML file and add a specific XSL style sheet to it then echo it to the browser. What I cant have is 3 different .XSL files siting on my server or the data source. So if there is some way I can save the XSL info as a variable and somehow apply all from my one PHP script that would be great. So far this is what I have: <?PHP $view = $_GET['view']; $xml_data = "http://externalserver.com/" . $view .".xml"; $handle = fopen($xml_data, 'r'); $Data = fread($handle, 512); fclose($handle); $old ='<?xml version="1.0" encoding="utf-8"?>'; //Right here is my biggest challange I dont wont the style sheets on the same server or any others for that matter since the server I am running this script on can not get out to the internet since it is behind a firewall. I was thinking of creating the XSL files on the fly and then saving them next to this script. But I would like to keep everything in just 1 file if at all possible. $new ='<?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet href="style.xsl" type="text/xsl"?>'; $final_xml = str_replace($old, $new, $Data); echo $final_xml; ?> the url would be http://www.myserver.com/getxml.php?view=weather
  8. Actually the xml does not have the <?xml-stylesheet href="filename.xsl" type="text/xsl"?> info in it when I pull it. So I am going to have the php insert the style sheet info. then echo the XML to the page. I am testing it now.
  9. I should have looked into XSL before. My life just got a little easier. Thanks! Next question. the XML I am outputting depends a lot on the users interaction. What I was thinking to do was based on the Users selection I would use PHP to call the raw XML file. I can then use PHP to insert the correct XSL style sheet (based on the users selection) and then echo that data to the display? how does that sound?
  10. well I am going to apply css styles and format the data to fit into a html layout that I built. I should have mentioned that.
  11. Trying to figure out what's best practice when it comes to parsing XML and echoing it into a pretty little table. should I save all the data in a array and then loop through the array? Or should I just echo the data directly from the XML file? Any thoughts would be welcomed.
  12. I am trying to connect to a MS database on a linux machine using odbc_connect(); I had a new box setup with the ODBC drivers installed and PHP 5.1.6 compiled with ODBC when I run inof.php I see in Configure Command --with-unixODBC=shared,/usr But when I try to do a simple connect I get: Fatal error: Call to undefined function odbc_connect() any obvious thoughts of what I may have missed?
  13. I am thinking I need to use CURLOPT_CAPATH instead of CURLOPT_CAINFO and then just put the cert in a directory.
  14. I am trying to pull page data from a web server using SSL with cURL. The owner of the web server gave me their CA certificate. When I run the code below all I get is a blanks screen (no errors) Is there anyway I can show were the script is breaking down? ini_set("display_errors","2"); ERROR_REPORTING(E_ALL); $url = "https://www.clientswebserver.com/"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1); curl_setopt($ch, CURLOPT_CAINFO, "/var/www/pathtoCAcert/curl-ca-bundle.crt"); $response = curl_exec($ch); curl_close($ch); print $response; The original CA cert I got was not named curl-ca-bundle.crt but I was told to rename it
  15. OK so the server I am connecting to gave me the CA Root certificate I am going to use cURL but don't want to download the certificate when I browse to the page because that will expire. Is there any other way of me connecting via https using the ca certificate?
  16. The url is https and it is not my server
  17. I am using the following code. $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $response = curl_exec($ch); curl_close($ch); I was given a .cer file should I set CURLOPT_SSL_VERIFYPEER to TRUE and set the path to the .cer file? Any help would be awesome. Thanks
  18. ok I had to set the $fileatt variable to include the actual file name not just the path to the folder. For some reason I am now getting 2 files in when I receive the email in outlook. One is empty and a different name. Weird?
  19. below is my mail code. I am not sure what I am doing wrong. It works in outlook every once in awhile. $fileatt = "/srv/www/##/####/files/"; // Path to the file $fileatt_type = "application/octet-stream"; // File Type $fileatt_name = "license.bin.".$num; // Filename that will be used for the file as the attachment $email_from = "sales@email.com"; // Who the email is from $email_subject = "email. License"; // The Subject of the email $email_message = "Please download file."; // Message that the email has in it $email_to = $email; // Who the email is too $headers = "From: ".$email_from; $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; $email_message .= "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type:text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $email_message . "\n\n"; $file = fopen($fileatt,'rb'); $fileinfo = fread($file,filesize($fileatt)); fclose($file); $fileinfo = chunk_split(base64_encode($fileinfo)); $email_message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $fileinfo . "\n\n" . "--{$mime_boundary}\n"; Can anyone see why I am having this issue?
  20. thanks for some reason I was thinking that would put that value in the first instance of the array. Which I didnt want. Thanks again.
  21. If I explode a string well using a substring when I implode that substring is now missing. for example. $exploded = explode("[MAC]",$data); $data = implode($exploded); Now [MAC] would be missing in the $data string. any way to get around this?
  22. having issues with echo curl_setopt($ch, CURLOPT_POSTFIELDS,"name='. $name .'&email='. $email .'&macs='.$mac_addresses.'&serial=".$serialnumber); the thing is $mac_addresses is a serialized array that should look like this 4a:4:{i:0;s:14:"98340234820384";i:1;s:16:"0980342883408230";i:2;s:11:"72843729374";i:3;s:16:"4209384082304980";} but when I unserilize $mac_addressed and echo it I get \'.a:4:{i:0;s:14:\"98340234820384\";i:1;s:16:\"0980342883408230\";i:2;s:11:\"72843729374\";i:3;s:16:\"4209384082304980\";}.\' can anyone see what my issue is?
  23. I have an array $array_1 ARRAY( [0] => info 1 [1] => info 2 [2] => info 3 ) and I have another array $array_2 ARRAY( [0] =>thank you and welcome to what ever [1] =>the info you added * thanks for entering your info ) I want to loop though the first array and place the values into the [1] of the second array. But the tricky thing is I want it to insert were the * is. foreach ($array_1 as $key => $val) { //not sure about this insert into ($array_2[1],after *, $val); } any help would be awesome.
  24. I need to find out how many times the "mac" key show is in an array. Array ( [serial] => Robert [added] => Peter [mac] => 1232091823 [mac] => 7538572375 [mac] =>943820348239804 [place] =>home )
×
×
  • 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.