-
Posts
1,832 -
Joined
-
Last visited
-
Days Won
3
Everything posted by salathe
-
It is certainly not impossible, though if you are struggling now then perhaps it best to offer up an alternative or two instead of what will inevitably be a confusing regex solution. Personally, if at all convenient, I would use the DOM extension to completely bypass the issue you're having. You could simply target the element with the id of test and magically have the entire thing very easily. If you still want someone to rise to the 'challange' then of course, I'm sure some kind fellow will be along to accommodate such a request.
-
The SJS that you want to use is just plain old JavaScript (with a few variables/objects pre-defined to make life easier[1]). You just need to use: pow_server.GET in place of $_GET A regular JS switch statement just like PHP pow_include() in place of include() [1] http://davidkellogg.com/wiki/Main_Page
-
You could use more basic string functions instead, for example: str_replace(',', '', '900,000,000,000') If you want to use a regular expression, the following simply removes all commas: preg_replace('/,/', '', '900,000,000,000')
-
Why is Feb 11 skipped?
-
What you used simply echoes an empty string (i.e. nothing). Please describe what you are doing to get ¨Å»pÝ×+ÑCw =žÍbGÝí`í`3ý†KûûvøÖKüÖK;ä{tÛöÛ«ÑÐå1§«�Žç™+§
-
The encoded file can be decoded fairly trivially. That said, I cannot see how you are running into problems with the decoded value being of the type that you mentioned in the first post. Given that this is obfuscated PHP source code (containing a license for use on one particular domain name) I don't think it would be ethical to give you the unobfuscated version of the file. Suffice it to say, if I can figure it out in a few minutes then so can you. If you want the decoded file, sorry. If you want to figure out why you're getting unexpected results from base64_decode then tell us what value you're passing into the function to give those results.
-
Looks to be a log file from some Anti-Virus software (based on some Google searching of key words from the file itself). Either way, it's only a text file: if you don't like it, delete it.
-
Well give us the encoded value and roughly what you are expecting it to be when decoded ("PHP code" is enough).
-
This might seem like a dumb question, but what is the problem? There is no reason (without knowing more details of your use of the code) why 'decoded' text cannot be what you say it is. So, more details needed.
-
Is there any reason why you're using a really old version of NuSOAP?
-
Where did you get the soapclient_gt class from?
-
breaks at work and what if you cant do something?
salathe replied to silverglade's topic in Miscellaneous
1. For me, officially, one hour for lunch (thought that's usually more like 10 minutes). Unofficially, taking a break occurs much more frequently: be it in the form of simply changing tasks, making tea, a chat about the latest sports/news events, and so on. Also, if you're typing at full speed for 8 hours a day, you're either a genius or not programming. As for resting your hands, you'll probably get the urge to get up and have a walk around more often than resting those poor hard-working hands. 2. It would be a really awful employer to fire a junior developer for not knowing something! If you're part of a team then ask questions of your work mates, they'll expect it (and probably relish the opportunity to be nice and talk things through, it'll give them a break from whatever they're doing). There's also, as you probably know, answers to pretty much every question ever conceived available on the interwebs already and plenty of avenues for getting those few answered that haven't been asked (or you can't be bothered to go find). Don't sweat about not knowing stuff, that's part of the job: to learn new things and improve yourself. P.S. Good luck with everything. -
The conversation went as so: You were kicked for trolling the channel. Good work.
-
Get the timestamp of midnight of the current day
salathe replied to JasonO's topic in PHP Coding Help
$midnight = strtotime('midnight'); echo date('r', $midnight); // Tue, 10 Feb 2009 00:00:00 +0000 -
The error is quite clear (if concise). The XML document ended prematurely, meaning that the parser was not expecting the end of the file to be at that point.
-
The SPL was added in PHP 5 (strictly 5.0.0 beta 4) and has been continuously improved upon since that point with new changes coming in the latest versions of PHP. If you browse to the manual page for a particular method of an SPL class, the version where it was introduced is printed at the top of the page. For example, for IteratorIterator::current: As thorpe quoted, as of PHP 5.3.0 the SPL extension cannot be disabled. Before that point, there is no guarantee that it will be enabled (but in my experience it is not common to disable it).
-
As has already been mentioned in this thread, the values within the $lines array will have line endings attached. In your case, each line has a trailing \n making the value on line 20 "change\n". Your comparison value, $ops, is simply "change" so the two values are not equal. Rather than using trim or another string manipulation approach, the thing to do would be to tell file not to include those line endings at all. That can be done by providing a behaviour flag to the call to file like: $lines = file("template.txt", FILE_IGNORE_NEW_LINES);
-
The problem is that you're only echoing the last value found, effectively ignoring any others. With stats[0] you only target the first stats, without the [0] you target them all but only ever keep a note of the last one which is echoed outside of the loop. Change your foreach loop such that each item gets echoed within the loop, or you store an array of names for use later. foreach ($xmlData->stats as $stats1) { echo "Name: " . $stats1->player[0]["name"]; }
-
You can use parse_url like: $hash = parse_url('www.domain.com/#1234', PHP_URL_FRAGMENT); echo $hash;
-
Google provide static images though I am not certain of the terms of that particular API. Also perhaps look into using OpenStreetMaps data.
-
Your original post was accessing a paragraph's text, your latest a series of anchors. Without more details, help will only be guess-work as the two do not appear to correlate. Give a sample of the HTML that you're accessing and what you want to do with it more precisely. P.S. You're using the foreach loop in a strange way, it could be changed to foreach($links as $href) saving the need for the first and last lines within the loop.
-
Given your current code, the following should do what you're wanting or at least point you in the general direction. $texts = $xpath->query('text()', $address->item(0)); foreach ($texts as $text) { $addr[] = trim($text->wholeText); } print_r($addr); The code should be pretty self-explanatory but basically it asks for the text nodes belonging to the paragraph and throws them onto the $addr array for later use. The output, if all goes to plan, should be: Array ( [0] => 100 New Drive [1] => New Town [2] => Manchester [3] => M1 AAA )
-
Hi Kazzie, welcome to PHPFreaks. Best wishes in getting your questions solved, and if you can share your own growing knowledge with others then so much the better! If (god forbid) you ever have any regular expressions questions, I am generally to be found roaming the dark halls and dusty rooms in that part of the forum. Only occasionally do they let me out into other areas (like this here Introductions forum).
-
Yes.
-
I like to use Tidy to clean up the potentially messy HTML (a lot of the web is very messy!) and DOMDocument for parsing into something I can query and get the required information in PHP. There are many branches from there; like Zend Framework's Zend_Dom_Query which uses DOM/XPath behind the scenes. There are even wrappers around regex-scraping if you wanted to go in that direction (but really, don't unless you have very specific reasons to do so).