|
Revitalized posted:So I gave up trying to start with node.js, and have turned to trying my hand at PHP since w3schools has a tutorial for it (which is easier for me to digest) First off please don't use w3schools as a learning resource, there are a lot of problems with the site but their PHP stuff is particularly bad. Unfortunately although there are a lot of PHP guides and tutorials on the internet, a lot of them are out of date or just poor. I don't know a good one to link to, or I would. If you've installed PHP then you can run PHP scripts from the command line by navigating to the directory where the script is and entering "php script_name.php". For example if your script is the standard "Hello World" that just echoes a string, then when running it from the command line you should see it print the string. If you install a web server I guess you may be able to interact with it as though it were a web site, but that's probably not needed for learning. It is a matter of preference but personally I'd prefer my computer PHP files to be opened in a text editor - that's what I want to do with it more often than execute it.
|
# ? May 13, 2012 01:00 |
|
|
# ? Jun 4, 2024 09:18 |
|
Scaramouche posted:I'm assuming Windows here; what I'd suggest is uninstalling all that stuff. I've had a dedicated server for quite a while, but if I recall WAMP wasn't that bad: Okay thanks, I'll try this right now. Hammerite posted:First off please don't use w3schools as a learning resource, there are a lot of problems with the site but their PHP stuff is particularly bad. Unfortunately although there are a lot of PHP guides and tutorials on the internet, a lot of them are out of date or just poor. I don't know a good one to link to, or I would. Well if anyone does come up with a good one that a beginner can use, I'll look into it. For now though, it'll have to get me started at least. I was designing my own website and the first wall I came into was making a working login/registration screen, which I found out I need some server side scripting knowledge to do, so that's why I'm looking into PHP now.
|
# ? May 13, 2012 02:14 |
|
I appreciate that this may start a derail, but if you're just getting into PHP, using a good editor like Notepad++ instead of plain old notepad can help a lot. If you're just getting into PHP and have questions, I'd say that's exactly what this thread is for - good luck!
|
# ? May 13, 2012 10:09 |
|
Masked Pumpkin posted:I appreciate that this may start a derail, but if you're just getting into PHP, using a good editor like Notepad++ instead of plain old notepad can help a lot. Notepad++ is excellent. There are also PHP modules/plugins for common IDEs such as Eclipse and IntelliJ. http://thinkvitamin.com/code/how-to-debug-in-php/ Ultimately, if you don't know how to use a debugger in whatever language you are programming in, you are crippled whether you realize it or not.
|
# ? May 13, 2012 19:01 |
|
baquerd posted:Notepad++ is excellent. There are also PHP modules/plugins for common IDEs such as Eclipse and IntelliJ. If you want to use Eclipse I highly recommend Aptana (http://aptana.org). It comes with PHP and other web languages pre-installed so you do not have to worry about configuring anything once you install it.
|
# ? May 14, 2012 13:38 |
|
Has anyone ever used FluentPDO? I was working on a usage metrics tool that supports different report types and date ranges on an HTML POST form, then pulls that data from a SQL backend. One of the requested features involves joining on another table with user ids for aggregate usage reports on departments, employee areas, etc. Right now the code is kind of a mess where I'm checking POST variables and adding WHERE, GROUP BY, and JOIN ON clauses to the queries manually via variables, with empty strings as the default (uggggggh). I bet 99% of PHP query builders are complete garbage but I wanted to check if this one was somewhat reasonable. It's basically a wrapper for PDO so it should be okay, right?
|
# ? May 14, 2012 22:05 |
|
I was so confused when I couldn't find the PHP thread, turns out I was on SHSC Have any of you guys played with the google API at all? In the coming weeks I'll need to play around with it and see if I can implement just a simple page to get directions from Point A to Point B and I have very little experience with.. any API / web services. Would have no idea where to start in PHP. e; Hm, now that I think about it I also remember a co-worker telling me the other day I guess you can actually use Google Spreadsheets as a database? A different sheet per table I guess? Sab669 fucked around with this message at 00:55 on May 17, 2012 |
# ? May 17, 2012 00:48 |
|
This is an okay introduction that'll hopefully get you over the hump of instantiating objects, making requests, etc. https://developers.google.com/maps/articles/phpsqlajax The two points thing I'm not sure of but this seems relevant: http://stackoverflow.com/questions/2296087/using-php-and-google-maps-api-to-work-out-distance-between-2-post-codes-uk
|
# ? May 17, 2012 01:38 |
|
I'm trying to quickly throw together a quick voting page system for SA members during Eurovision, but having a bit of difficulty with the validation. Like most SA-based sites, I'm hoping to use a string of text on the profile screen to validate, but when I do a quick parse using the file_get_contents command, the forum rightfully doesn't think my server is logged in and won't pass the info across. Is there a nice easy way to get my server to use my login so I can read the profiles? I'm guessing it could be done with a cookie, but not sure the easiest way to do it. edit: have been trying with cURL all afternoon and getting no closer... I'm not quite sure which URLs to use and where. I've grabbed some data using Tamper and the form itself is dead simple... the 'closest' I think I'm coming is the below, which then redirects to my web root, possibly due to the refresh in the login page. php:<? $curl_handle=curl_init(); curl_setopt( $curl_handle, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1" ); curl_setopt($curl_handle,CURLOPT_URL,'http://forums.somethingawful.com/account.php'); curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2); curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,true); curl_setopt($curl_handle,CURLOPT_COOKIEFILE,dirname( __FILE__ ).DIRECTORY_SEPARATOR."cookie.log"); curl_setopt($curl_handle,CURLOPT_COOKIEJAR,dirname( __FILE__ ).DIRECTORY_SEPARATOR."cookie.log"); curl_setopt($curl_handle,CURLOPT_REFERER,'http://forums.somethingawful.com/account.php'); curl_setopt($curl_handle,CURLOPT_POST,true); curl_setopt($curl_handle,CURLOPT_POSTFIELDS,"action=login&username=The+pHo&password=XxxXxXxXXxxXxXx"); curl_setopt($curl_handle,CURLOPT_FRESH_CONNECT,true);//No caching curl_setopt($curl_handle,CURLOPT_FOLLOWLOCATION,true); curl_setopt($curl_handle,CURLOPT_MAXREDIRS,1); $buffer=curl_exec($curl_handle); curl_close($curl_handle); echo $buffer;?> edit: aaaaand got it, the code on this site worked. Might have to bookmark this for future use, as I'm bound to get caught up on the same thing again! http://www.phpcodester.com/2011/01/scraping-a-password-protected-website-with-curl/ EL BROMANCE fucked around with this message at 18:21 on May 17, 2012 |
# ? May 17, 2012 14:08 |
|
You could have also just used alluvion. http://www.alluvion.org/authdb.txt
|
# ? May 18, 2012 00:06 |
|
I'm trying to do a pass through download via php and curl. I am presenting the user with a link to download a file that appears to be local. What I want to do is actually download the file from a different location and pass that seamlessly to the user. This keeps credentials required for the file download private from the user and it appears to come from my site. Something to note is that the files may range in size from 10mb to 1gb so I can't wait for the download to complete and then serve it to the user. The purpose is to provide a seamless process without confusing the user by linking them to a different download location. I've read how to download the file with Curl and save it locally, but I want it to be completely transparent. Any ideas?
|
# ? May 18, 2012 01:51 |
|
Just do some URL rewriting. Have the request goto mydomain.com/fileIdOrWhatever/filename.exe which is just rewritten to goto myscript.php?id=fileIdOrWhatever and direct the request to the correct location.
|
# ? May 18, 2012 21:54 |
|
Yeah this sounds like a job for .htaccess
|
# ? May 18, 2012 22:05 |
|
edit: nm, stupid question that had nothing to do with the problem
Golbez fucked around with this message at 15:44 on May 22, 2012 |
# ? May 22, 2012 15:32 |
|
I am working on extracting the XML data from a response string for a payment gateway. I can verify the response by searching for terms like 'Successful,' but when I try to use Simple XML to parse the response string, then I run into problems. I send our requests using curl and this is a typical response we would get from the gateway:quote:HTTP/1.1 200 OK Date: Mon, 21 May 2012 22:17:41 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET X-AspNet-Version: 2.0.50727 Cache-Control: private, max-age=0 Content-Type: text/xml; charset=utf-8 Content-Length: 229 <Response><Code>000</Code><Message>Successful</Message><Value>30272720</Value></Response> What I've noticed is that when the header data (i.e. anything before the <Response> tag is there, then I can't seem to extract the data from XML. If I take that same string and remove the header info, then I can get data from the XML: php:<? $response = <<<XML <Response><Code>000</Code><Message>Successful</Message><Value>30272691</Value></Response> XML; $xml = simplexml_load_string($response); echo $xml->Value; // Prints out 30272691 ?> Aniki fucked around with this message at 19:47 on May 23, 2012 |
# ? May 23, 2012 19:35 |
|
Set the CURLOPT_HEADER option to 0 so the response does not include headers, just the raw XML.
|
# ? May 23, 2012 19:42 |
|
musclecoder posted:Set the CURLOPT_HEADER option to 0 so the response does not include headers, just the raw XML. I tried doing that and I got the following response: quote:Warning: curl_setopt() [function.curl-setopt]: You must pass either an object or an array with the CURLOPT_HTTPHEADER, CURLOPT_QUOTE, CURLOPT_HTTP200ALIASES and CURLOPT_POSTQUOTE arguments in /home/.../gatewayTest.php on line 21 This is the function that I'm using to send the request: php:<? function sendRequest($url, $queryString, $port) { // Checks to see if a port variable has been pass through if (empty($port)) { $port = ""; } // End if if (empty($port)) $user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); // If the port is not empty, then it will set the port to the user defined port, otherwise the port settings will not be changed. if ($port != "") { curl_setopt ($ch, CURLOPT_PORT , $port); // Added preferred PayPal port } // End if ($port != "") //curl_setopt($ch, CURLOPT_HTTPHEADER, curl_getinfo($ch)); curl_setopt($ch, CURLOPT_HTTPHEADER, 0); curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); curl_setopt($ch, CURLOPT_HEADER, 1); // tells curl to include headers in response curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable curl_setopt($ch, CURLOPT_TIMEOUT, 45); // times out after 45 secs curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // this line makes it work under https curl_setopt($ch, CURLOPT_POSTFIELDS, $queryString); //adding POST data curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); //verifies ssl certificate curl_setopt($ch, CURLOPT_FORBID_REUSE, TRUE); //forces closure of connection when done curl_setopt($ch, CURLOPT_POST, 1); //data sent as POST $result = curl_exec($ch); //$headers = curl_getinfo($ch); $headers = ""; curl_close($ch); return $result; } ?> curl_setopt($ch, CURLOPT_HTTPHEADER, 0); And previously I had been using: curl_setopt($ch, CURLOPT_HTTPHEADER, curl_getinfo($ch)); Even with the errors and the CURLOPT_HEADER option being set to 0, I get the following response: quote:HTTP/1.1 200 OK Date: Wed, 23 May 2012 19:10:27 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET X-AspNet-Version: 2.0.50727 Cache-Control: private, max-age=0 Content-Type: text/xml; charset=utf-8 Content-Length: 209 <Response><Code>207</Code><Message>Missing or invalid amount</Message></Response> Do you guys have any thoughts on what I could do differently when I am sending the curl request to get a response that is just XML?
|
# ? May 23, 2012 20:15 |
|
quote:curl_setopt($ch, CURLOPT_HEADER, 1); // tells curl to include headers in response
|
# ? May 23, 2012 20:17 |
|
Like the docs say, CURLOPT_HTTPHEADER takes an array of values. Not a scalar. http://us2.php.net/curl_setopt Edit: Also what Biowarfare and I just said a second ago. Do that.
|
# ? May 23, 2012 20:21 |
|
Biowarfare posted:try 0 for that? Thank you, I can't believe that I missed that. Making that change did return an XML only response. I'll work on the XML handling now and see what kind of progress I can make. At least I have a clean XML response to work with now.
|
# ? May 23, 2012 21:40 |
|
poo poo like that is why using a well-tested HTTP wrapper is usually a wise choice. Even PEAR's horribly out of date HTTP_Request2 is a better choice than having to wrangle curl every time.
|
# ? May 24, 2012 05:15 |
|
McGlockenshire posted:poo poo like that is why using a well-tested HTTP wrapper is usually a wise choice. Personally I like pecl_http (docs), but it's admittedly not that helpful if you can't modify your php installation (so it's pretty much right out if you're on shared hosting).
|
# ? May 24, 2012 13:24 |
|
McGlockenshire posted:poo poo like that is why using a well-tested HTTP wrapper is usually a wise choice. Something like that may not be a bad idea. I'll need to look into HTTP_Request2 and pecl_http and see what I think of them. I'm still having trouble dealing with the XML responses that I get from this gateway. It will return a response like this: quote:<Response><Code>207</Code><Message>Missing or invalid amount</Message></Response> Which appears to be valid XML. If I take that response and manually store it in a string like this: php:<? $response = sendRequest('https://...REMOVED.../SaveSingleTransaction', $gatewayString, "", "GATEWAY NAME"); $response = '<Response><Code>000</Code><Message>Successful</Message><Value>30272691</Value></Response>'; $xml = <<<XML $response XML; $domResponse = new DOMDocument(); $domResponse->loadXML($response); echo "<br /><br />SAVE XML :: " . $domResponse->saveXML() . "<br /><br />"; $domResponseElement = $domResponse->documentElement; $i = 0; foreach ($domResponseElement->childNodes AS $item) { print $i . " " . $item->nodeName . " = " . $item->nodeValue . "<br />"; $i++; } ?> quote:SAVE XML :: 000Successful30272691 However, if I try directly loading the response into Dom Documents via loadXML($response), like this: php:<? function sendRequest($url, $queryString, $port, $gateway) { // Checks to see if a port variable has been pass through if (empty($port)) { $port = ""; } // End if if (empty($port)) if (empty($gateway)) { $gateway = ""; } // if (empty($gateway)) $user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); // If the port is not empty, then it will set the port to the user defined port, otherwise the port settings will not be changed. if ($port != "") { curl_setopt ($ch, CURLOPT_PORT , $port); // Added preferred PayPal port } // End if ($port != "") curl_setopt($ch, CURLOPT_HTTPHEADER, curl_getinfo($ch)); //curl_setopt($ch, CURLOPT_HTTPHEADER, 0); curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); if ($gateway == 'GATEWAY NAME') : curl_setopt($ch, CURLOPT_HEADER, 0); // tells curl to exclude headers in the response else : curl_setopt($ch, CURLOPT_HEADER, 1); // tells curl to include headers in the response endif; curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable curl_setopt($ch, CURLOPT_TIMEOUT, 45); // times out after 45 secs curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // this line makes it work under https curl_setopt($ch, CURLOPT_POSTFIELDS, $queryString); //adding POST data curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); //verifies ssl certificate curl_setopt($ch, CURLOPT_FORBID_REUSE, TRUE); //forces closure of connection when done curl_setopt($ch, CURLOPT_POST, 1); //data sent as POST $result = trim(curl_exec($ch)); //$headers = curl_getinfo($ch); $headers = ""; curl_close($ch); return $result; } $response = sendRequest('https://...REMOVED.../SaveSingleTransaction', $gatewayString, "", "GATEWAY NAME"); $domResponse = new DOMDocument(); $domResponse->loadXML($response); echo "<br /><br />SAVE XML :: " . $domResponse->saveXML() . "<br /><br />"; $domResponseElement = $domResponse->documentElement; $i = 0; foreach ($domResponseElement->childNodes AS $item) { print $i . " " . $item->nodeName . " = " . $item->nodeValue . "<br />"; $i++; } ?> quote:SAVE XML :: <Response><Code>207</Code><Message>Missing or invalid amount</Message></Response> When I look at the source for this line, "0 #text = 207Missing or invalid amount," I find that the XML tags are still there quote:<br><br>0 #text = <response><code>207</code><message>Missing or invalid amount</message></response><br></body></html> So as far as I can tell, when I try to load the response, is being interpretted as a string and not XML data. I've tried adding this, '<?xml version="1.0" encoding="utf-8"?>', to beginning of the response string, it just yields an error that I am tryig to get the property of a non-object. Do you guys think the problem is being caused by the XML or is there a different way that I can handle or caste the response string so that it can actually be imported into Dom Document as an XML string?
|
# ? May 24, 2012 19:17 |
|
mooky posted:I'm trying to do a pass through download via php and curl. Doh004 posted:Just do some URL rewriting. Have the request goto mydomain.com/fileIdOrWhatever/filename.exe which is just rewritten to goto myscript.php?id=fileIdOrWhatever and direct the request to the correct location. Unfortunately that won't work. A direct link to the file requires a username and password. I can authenticate via curl headers but I don't want to use PHP resources to download and serve the file to the user. I only want to use PHP + curl to pass through authentication and transparently serve this file as though it is coming from the page the user is on. Example: http://iammooky.com/somescript.php?fileid=1 would actually serve a file from here: https://someotherresource.com/authorized/download.cgi?file=1 The user doesn't need to know where the file is coming from although it isn't a big secret. I just can't link the user to the file download or it will require a username and password.
|
# ? May 29, 2012 15:40 |
|
I think this is a better example of what I want to do... Use PHP + curl to retrieve remote file Use PHP Stream functions to stream file to user without saving the file locally. Avoid PHP memory limit and max execution time issues Keep the file source hidden from the user I have no idea how to use the php stream functions, I'm hoping someone has done this and can share some tips.
|
# ? May 29, 2012 16:53 |
|
quote:[29-May-2012 18:41:44] PHP Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in \model\cartItems.php on line 5 edit; I guess if I move the properties after the constructor it seems fine? Sab669 fucked around with this message at 17:55 on May 29, 2012 |
# ? May 29, 2012 17:48 |
|
Don't you need to prepend those with var? var $unitPrice; var $quanity; ...
|
# ? May 29, 2012 17:56 |
|
Sab669 posted:So I'm pretty amateur at PHP, especially with object oriented PHP... no idea why this isn't working... I'm pretty sure you can't just declare class properties with a $variable, you need to have a visibility keyword: public, private, or protected. So the third line above would then become private $unitPrice, for example. As for which to use, good question, I'm not qualified to say which, but setting them all to public would have the least ramifications on your code, at least as it is now. More information: http://us.php.net/manual/en/language.oop5.properties.php
|
# ? May 29, 2012 17:58 |
|
Superdawg posted:Don't you need to prepend those with var? I had looked at the this page quickly and it didn't say so, but yea as the above guy mentioned I also needed to declare the scope. I'm just doing something quick and dirty, mostly as a proof of concept so that's why I hadn't bothered. I figured it just defaulted to public and for the time being that's perfectly fine. I know they should rarely be public in the real world, though.
|
# ? May 29, 2012 18:16 |
|
Superdawg posted:Don't you need to prepend those with var? var is kept around only for backwards compatibility, declaring with the scope is preferred. It is not technically deprecated though.
|
# ? May 29, 2012 19:10 |
|
I sort of figured out the XML issue that I was having. I seem to turn the XML string into a proper object with SimpleXML or DOMDocument. If I created a string with the same output as the response then it would work, but for some reason I couldn't turn the response into an object. I ended up using the following function to successfully parse the response:php:<?php /** * Convert XML to an Array * * @param string $XML * @return array */ function XMLtoArray($XML) { $xml_parser = xml_parser_create(); xml_parse_into_struct($xml_parser, $XML, $vals); xml_parser_free($xml_parser); // wyznaczamy tablice z powtarzajacymi sie tagami na tym samym poziomie $_tmp=''; foreach ($vals as $xml_elem) { $x_tag=$xml_elem['tag']; $x_level=$xml_elem['level']; $x_type=$xml_elem['type']; if ($x_level!=1 && $x_type == 'close') { if (isset($multi_key[$x_tag][$x_level])) $multi_key[$x_tag][$x_level]=1; else $multi_key[$x_tag][$x_level]=0; } if ($x_level!=1 && $x_type == 'complete') { if ($_tmp==$x_tag) $multi_key[$x_tag][$x_level]=1; $_tmp=$x_tag; } } // jedziemy po tablicy foreach ($vals as $xml_elem) { $x_tag=$xml_elem['tag']; $x_level=$xml_elem['level']; $x_type=$xml_elem['type']; if ($x_type == 'open') $level[$x_level] = $x_tag; $start_level = 1; $php_stmt = '$xml_array'; if ($x_type=='close' && $x_level!=1) $multi_key[$x_tag][$x_level]++; while ($start_level < $x_level) { $php_stmt .= '[$level['.$start_level.']]'; if (isset($multi_key[$level[$start_level]][$start_level]) && $multi_key[$level[$start_level]][$start_level]) $php_stmt .= '['.($multi_key[$level[$start_level]][$start_level]-1).']'; $start_level++; } $add=''; if (isset($multi_key[$x_tag][$x_level]) && $multi_key[$x_tag][$x_level] && ($x_type=='open' || $x_type=='complete')) { if (!isset($multi_key2[$x_tag][$x_level])) $multi_key2[$x_tag][$x_level]=0; else $multi_key2[$x_tag][$x_level]++; $add='['.$multi_key2[$x_tag][$x_level].']'; } if (isset($xml_elem['value']) && trim($xml_elem['value'])!='' && !array_key_exists('attributes', $xml_elem)) { if ($x_type == 'open') $php_stmt_main=$php_stmt.'[$x_type]'.$add.'[\'content\'] = $xml_elem[\'value\'];'; else $php_stmt_main=$php_stmt.'[$x_tag]'.$add.' = $xml_elem[\'value\'];'; eval($php_stmt_main); } if (array_key_exists('attributes', $xml_elem)) { if (isset($xml_elem['value'])) { $php_stmt_main=$php_stmt.'[$x_tag]'.$add.'[\'content\'] = $xml_elem[\'value\'];'; eval($php_stmt_main); } foreach ($xml_elem['attributes'] as $key=>$value) { $php_stmt_att=$php_stmt.'[$x_tag]'.$add.'[$key] = $value;'; eval($php_stmt_att); } } } return $xml_array; } Luckily, the response I get is relatively simple and only related to one transaction at a time, so it will work for this application. I'm just happy to get this stupid thing working without resorting to work arounds like searching the string or parsing it using regular expressions.
|
# ? May 29, 2012 22:13 |
|
Golbez posted:I'm pretty sure you can't just declare class properties with a $variable, you need to have a visibility keyword: public, private, or protected. So the third line above would then become private $unitPrice, for example. As for which to use, good question, I'm not qualified to say which, but setting them all to public would have the least ramifications on your code, at least as it is now. Public means it can be called from outside the class, e.g. $classobj->method(). Private means that only the class itself can call it from within, and protected means only classes that extend the class may use it.
|
# ? May 29, 2012 22:13 |
|
Does anyone have any experience with VIP Authentication and PHP? It's a SOAP API, but I hate SOAP and was hoping a Class might already exist. https://www-secure.symantec.com/connect/sites/default/files/VIPTestDrive.zip DarkLotus fucked around with this message at 23:47 on May 29, 2012 |
# ? May 29, 2012 23:44 |
|
Has anyone else had this problem with Xdebug? Whenever I set a breakpoint after I've done a PDO fetch from a result set, Xdebug will crash and disconnect. I know it's specifically the fetch, since I've tried breakpoints elsewhere, and they're fine. But once I've passed the point in execution where I've done the fetch and I want to see the output in the debugger, no dice. It will hang while waiting to load, then after about 5 seconds "Process finished with exit code -1073741819". This is on PHP 5.4.
|
# ? May 30, 2012 20:18 |
|
I'm looking to apply to a pretty large company whose main platform is PHP and MySQL. I've been doing LAMP development for about 8 or so years through high school and college, but never professionally. I've spent the past year working for a company doing C# work, so I have experience in the field. I haven't really kept up with the latest or greatest things going on with the newer versions of PHP (really only dabled with OOP in PHP) and anything I did previously is pretty out of date. Is there anything you guys would suggest I read up on? I'm not looking to learn about any PHP frameworks as this place runs everything custom (frameworks are too slow), but any extensions that are pretty neat? I'd love to not seem outdated when I go talk to them. Thanks
|
# ? Jun 1, 2012 21:43 |
|
PDO - PHP Data Objects - the PHP database abstraction library to use. DateTime - Useful and extensive date and time library. Process Control - The closest thing PHP will have to actual threads. SPL - Standard PHP Library - Bunch of useful classes in here. Iterators Exceptions Interface Be wary of a company that won't use a framework because they're to slow. The big ones are often much more tested than something built in how. Make sure they don't have NIH syndrome too much and there's a reason they built their own framework.
|
# ? Jun 1, 2012 22:00 |
|
I think if you have 8 years of real PHP experience, professional or otherwise, you're in pretty good shape. If the interpreter gives you deprecation warnings, just check out the replacement methods on php.net. If you're procedural by nature, as I am, then OO can take a little while to wrap your head around if you're new to it all. But if you have a mind for programming, you'll figure it out pretty easily. Syntax isn't really all that different. You just kinda think about things a little differently.
|
# ? Jun 1, 2012 22:07 |
|
Make sure you understand the basics and caveats of PHP5, the way PHP implements and uses OOP and how that differs from other systems (like C#), and know all or most of the default security problems (like how to prevent SQL injection, path traversal, cross site request forgery and cross site scripting), you should be fine. Even if you use a framework, you'll run into problems related to these often and you need to know how to deal with them. Personally, I don't code too much PHP (or any at all lately), but the company I work for does and these things come up often. Even if you only call these basics by name, you're already one large step ahead of the pack.
|
# ? Jun 1, 2012 22:20 |
|
Thanks for the advice guys. Hopefully it pans out
|
# ? Jun 3, 2012 04:48 |
|
|
# ? Jun 4, 2024 09:18 |
|
.htaccess question: Another website has screwed up a potentially high-traffic link to my site. They've accidentally(?) appended a tracking code onto the URL so users who click their link to us end up at http://example.com/?&tokenid=fbb7e521-21da-4db2-97eb instead of at our homepage, http://example.com. So they end up at a page not found error instead of at our homepage. I figured the easiest fix would be to use RedirectMatch in my .htaccess file to point users accessing that URL to the correct homepage: code:
|
# ? Jun 4, 2012 15:32 |