Jump to content

salathe

Staff Alumni
  • Posts

    1,832
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by salathe

  1. What version of PHP are you using?
  2. Yes.
  3. Are you sure that you want to be removing/changing the links? Flickr's guidelines require the photo to link back to its associated photo page.
  4. My first suggest would be to not accept invalid XML; to get the XML provider to fix their broken feed. However, to focus on the issue that you're having you need to look at the greedy/lazy behaviour of quantifiers (like * for zero-or-more, + for one or more, {3,6} for three-to-six [inclusive]) in your regular expression. .* is greedy (it will match as much as possible) whilst .*? is lazy (it will match only as much as is necessary). More info: http://php.net/regexp.reference.repetition
  5. See more: http://php.net/regexp.reference.backslash
  6. You don't need substr for that, you can use strpos: if (strpos($str, 'http://') === 0) {
  7. carlosx2, could you explain what you really want a little more clearly? The topic title, first line and later comments are a confusing muddle of nothing much at all. Do you really want some code to tell you if a MIME type is there (where?), or do you want to check file extensions like gwolgamott suggested, or do you want to check if a folder contains more than 2 files, or...?
  8. Number 5 is invalid, the others are OK. &$variable is just a normal variable, using the reference operator to get a reference for it. @$foo is again a normal variable just with the error control operator in front.
  9. This was brought up a while back with various solutions proposed; nothing got done about it.
  10. Or you could just preg_replace('/[-_]/', 'x', $requestUri) (example replaces with x because replacing _ with _ seemed silly).
  11. For truncating the file, you'll want to use ftruncate on the open file handle, rather than closing it and opening again in write mode.
  12. Hello spambadger, nice name!
  13. Why are (or what is the logic for) the large values split to 5,000 + 5500 and 5,000 + 5,300 instead of taking up the maximum value 10,000 + 500 and 10,000 + 300?
  14. Yes. I don't know, have you? Yes. Oh and for which is better, both; it depends.
  15. You probably need to figure out a nice automated way of creating many installations of the software, or using software that allows separate instances of itself to run, or create/find software that does those things, or do it all manually. What are you trying to ask us about; you're not asking very many questions.
  16. Um, great? What is your question?
  17. Q: how to turn a exsisting site into hosting site? A: Don't.
  18. Do you want to use regex, or would you be open to other (arguably more "correct") ways of parsing HTML content? What have you tried already? How/why are you doing this; are you loading the whole page; a remote page? Sorry for all the questions, just answers to those will likely alter our suggestions for how you approach this.
  19. Have a read about "character classes" (the [...] syntax), a good start would be to read www.regular-expressions.info/charclass.html
  20. What have you tried already?
  21. Could you give some more context about how/where you need to do this (un)escaping? I have the sneaking impression that there could/should/might be a better way.
  22. If you want to do this using cURL: you can make a request to the URL (e.g. site.com/1234; be sure to use appropriate cURL options, like follow location) then use curl_getinfo with CURLINFO_EFFECTIVE_URL (aside: curl_getinfo returns lots of useful information) to get the URL that the remote page redirected to. Then, to access the part(s) of the URL that you need, you can use parse_url and parse_str. P.S. The only thing difficult is working out what you really want from the descriptions given.
  23. No, it seems you just haven't fully read the documentation. To access namespaced items, use the children method on an element.
  24. Do you really want to un-capitalize the "PERTH" into "Perth"? Is there any need to do this in UltraEdit, with a tiny PHP script you could read the comma-separated file into whatever format you like with whatever text transformations you like.
  25. Yet you come here asking for help with it? :S
×
×
  • 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.