Jump to content

sKunKbad

Members
  • Posts

    1,832
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by sKunKbad

  1. For some reason, when you view the http header info for my .php pages, it does not show a last modified date and time. So, thinking that I could create one, I tried this: <?php header("Last-Modified: ".filectime($_SERVER['PHP_SELF']); ?> but it doesn't work. Does anyone know how to do what I am trying to do?
  2. I agree that there really is no need for a "forever" cookie, I was just curious. When you sign in to this forum it gives you a "forever" option, so I just wondered.
  3. I am trying to include a file in the same directory using the standard code: include('textlinks.inc'); and I get this error: Warning: include() [function.include]: Failed opening 'textlinksinc' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\tvsc\new_php_files\4salebyowner.php on line 65. I'm guessing it's saying all my includes need to be in the C:\php5\pear folder, but I just want the includes in my www directory. How do I fix this? Thanks in advance,
  4. session_set_cookie_params(604800); I could make this cookie last a long time by raising the number of seconds, but is there a way to make it last "forever"?
  5. urldecode() if the file name has a . in it.
  6. I'm on Firefox 1.5 and both pages validate extactly the same.
  7. why not include() it?
  8. Are you sure you have php installed on your server?
  9. I couldn't figure out how to do it with file_get_contents() and still have the appropriate whitespace and line breaks. I did however provide a good solution to the original question, so maybe somebody else can come up with another way or a better way and share. I'm still a php newbie!
  10. This worked: <?php $lines = file('http://www.yoursite.com'); foreach ($lines as $line_num => $line) { echo str_replace(" "," ",htmlentities($line)) . "<br />\n"; } ?>
  11. Actually, when you look at the actual HTML code that is opened, there are tab characters on many lines, but they are not being represented in the output.
  12. i don't want to trim the whitespace, i want it left in!
  13. i tried to edit my post, but the time to edit had expired. I got that code from the php docs on php.net. I was hoping to figure out a way to leaving in the whitespace, so that the html looks nicer when displayed, but I haven't figured it out.
  14. $lines = file('http://www.anothersite.com/page.php/'); foreach ($lines as $line_num => $line) { echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n"; }
  15. <?php $var = "I like pizza & pasta"; echo preg_replace("/ & /","&",$var); ?> can't you just add spaces around the ampersand and get what you want?
  16. I'm a regex newbie, can you please explain this one.
  17. There's a type of lightbox called slimbox, and I use it because it is about half the download size. Where is LightBoxGoneWild?
  18. Life would be way easier for you if you are running php5 to just use simpleXML.
  19. This is from [url=http://www.sitepoint.com/blogs/2005/10/20/simplexml-and-namespaces/]http://www.sitepoint.com/blogs/2005/10/20/simplexml-and-namespaces/[/url], and was the only documented example I could find regarding parsing XML namespaces with php: SimpleXML and namespaces by Kevin Yank There’s a lot about SimpleXML, PHP5’s new API for accessing the contents of XML documents, in SitePoint’s recently-published book No Nonsense XML Web Development With PHP, but one thing it doesn’t cover is how to use SimpleXML with a document that makes use of XML Namespaces. Take this document, for example—a simplified RSS 1.0 feed: [code]<?xml version="1.0" encoding="utf-8"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"     xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/">   <channel rdf:about="http://www.sitepoint.com/">     <title>SitePoint.com</title>     <link>http://www.sitepoint.com/</link>     <description>SitePoint is the natural place to go to grow your online business.</description>     <items>       <rdf:Seq>         <rdf:li rdf:resource="http://www.sitepoint.com/article/take-command-ajax" />       </rdf:Seq>     </items>   </channel>   <item rdf:about="http://www.sitepoint.com/article/take-command-ajax">     <title>Take Command with AJAX</title>     <link>http://www.sitepoint.com/article/take-command-ajax</link>     <description>Want to get a bang out of your AJAX artillery?</description>     <dc:date>2005-10-14T04:00:00Z</dc:date>   </item> </rdf:RDF>[/code] In PHP5, here’s how you might think to use SimpleXML’s API to get at the date of every item in the feed: [code=php:0] $feed = simplexml_load_file('http://www.sitepoint.com/recent.rdf'); foreach ($feed->item as $item) {   echo $item->date; } [/code] But this won’t work, because the date element has a namespace prefix (<dc:date>), so it can’t be accessed by the usual means. Here’s the solution. First, check what the URI is for the namespace. In this case, the dc: prefix maps to the URI http://purl.org/dc/elements/1.1/: [code]<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"     xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/"> [/code] Then use the children method of the SimpleXML object, passing it that URI: [code=php:0] $feed = simplexml_load_file('http://www.sitepoint.com/recent.rdf'); foreach ($feed->item as $item) {   $ns_dc = $item->children('http://purl.org/dc/elements/1.1/');   echo $ns_dc->date; } [/code] When you pass the namespace URI to the children method, you get a SimpleXML collection of the child elements belonging to that namespace. You can work with that collection the same way you would with any SimpleXML collection. You can use the attributes [url=http://www.php.net/manual/en/function.simplexml-element-attributes.php]http://www.php.net/manual/en/function.simplexml-element-attributes.php[/url] in the same way to obtain attributes with namespace prefixes.
  20. I need the same solution. Did you figure it out?
  21. Since I posted the question, I learned a little about php5's soap, and it appears this needs to be a non-WSDL request, but after playing a little, I'm getting nowhere. I don't know exactly what the location and uri are supposed to be for the non-WSDL request, and how to get the results of the request to print. I'm not opposed to learning, but I haven't found a whole lot of info on what I'm trying to do here. Anyone have some tips?
  22. I have some code that works in php4, and uses nusoap.php. If I remove the include to nusoap for php5, I get errors. Do I need to do something other than removing the include? Here's the code: <?php /* display SOAP errors */ function showErrors( $soapclient, $results ) { echo 'Request: <xmp>'.$soapclient->request.'</xmp>'; echo 'Response: <xmp>'.$soapclient->response.'</xmp>'; echo 'Debug log: <pre>'.$soapclient->debug_str.'</pre>'; echo $results['faultstring']; } //require_once('./nusoap/nusoap.php'); //php5 is supposed to have its own soap, so I shouldn't need this. $soapclient = new soapclient('http://www.biblegateway.com/usage/votd/'); $parameters= array('preferences'=>array('version_id'=>'31', 'utc_offset'=>'-5'), 'options'=>array('include-copyright'=>'both') ) ); $results = $soapclient->call('doGetVotd',$parameters); if($err = $soapclient->getError()){ showErrors($soapclient, $results); } else { print $results; } ?>
  23. They don't call you "Super Moderator Genius" for nothing! Thanks!
  24. I need to be able to set my WAMP installation to process files with a .php5 file extension, but can't find where to make a setting change to do it. Please help.
  25. godaddy has php5, but i don't know about the xslt
×
×
  • 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.