[PHP] PHP to answer HEAD requests
Is it possible to use PHP to answer HEAD http requests? Is it as simple as doing something like: header('blah') exit; I'd expect PHP to produce a full page rather than just a header though. -- Dan Field d...@llgc.org.uk Ffôn/Tel. +44 1970 632 582 Peiriannydd Meddalwedd Senior Software Engineer Llyfrgell Genedlaethol Cymru National Library of Wales
[PHP] numerically named member variables and objects
As far as I was aware, member variable and object names had to start with a non integer chracter, however I am utilising a JSON lib which is providing me with the following resultset. As you can see a member class member is numerically named and I am unable to address it in the usual way. Is there a way around this? Here's a snippet from a print_r() of the object [highlighting] = stdClass Object ( [12192] = stdClass Object ( [t_text] = Array ( [0] = [advert] PRIORY PRESS LIMITED THE FRIARY - emCARDIFF/em TELEPHONE 3578 ) ) [12193] = stdClass Object ( [t_text] = Array ( [0] = Religion. Low Performing Fees THE BOOK - 1/6 From the Publishers― PRIORY PRESS LIMITED The Friary - emCardiff/em ) ) echo $this-results-highlighting-12192-t_text[0]; results in [Wed Mar 11 11:32:57 2009] [error] [client xx.xx.xx.xx] PHP Parse error: syntax error, unexpected T_LNUMBER, expecting T_STRING or T_VARIABLE or '{' or '$' in /var/www/ccymod/application/views/scripts/ browse/search.phtml on line 62 I'm stumped. Any ideas? -- Dan Field d...@llgc.org.uk Ffôn/Tel. +44 1970 632 582 Peiriannydd Meddalwedd Senior Software Engineer Llyfrgell Genedlaethol Cymru National Library of Wales
Re: [PHP] numerically named member variables and objects
On 11 Mar 2009, at 11:42, Dan Field wrote: As far as I was aware, member variable and object names had to start with a non integer chracter, however I am utilising a JSON lib which is providing me with the following resultset. As you can see a member class member is numerically named and I am unable to address it in the usual way. Is there a way around this? echo $this-results-highlighting-12192-t_text[0]; And to answer my own question, the answer is to use the following notation: echo $this-results-highlighting-{'12192'}-t_text[0]; -- Dan Field d...@llgc.org.uk Ffôn/Tel. +44 1970 632 582 Peiriannydd Meddalwedd Senior Software Engineer Llyfrgell Genedlaethol Cymru National Library of Wales
[PHP] use xml_set_character_data_handler outside of scope
I've tried a couple of different ways to use this function to set a variable outside of the usual scope of my characterData function but I'm not having much luck. Heres some sample code: ?php $xml_repository = /var/www/html/mets/sample/; $depth = array(); $searchable_tags = array(MODS:TITLE); $current_data = ; $dir_array = array(); $hits = 0; $MAXHITS = 100; $search_term; $flag = false; function startElement($parser, $name, $attrs) { global $depth, $searchable_tags, $current_data, $hits, $colour, $flag; if (in_array($name,$searchable_tags)) { if (preg_match(/.$search_term./i,$current_data)) { $flag = true; echo div bgcolor=\#$colour\$current_data/divbr /; $hits++; } } $depth[$parser]++; } function characterData($parser, $data) { global $current_data; $current_data = $data; } function endElement($parser, $name) { global $depth, $flag; $depth[$parser]--; if ($flag) { $flag = false; } } function search_data($term,$data) { if (preg_match($term,$data)) { return true; } else { return false; } } // read all the xml files and parse through search engine if ($handle = opendir($xml_repository)) { $i = 0; while (false !== ($file = readdir($handle))) { $dir_array[$i] = $file; $i ++; } closedir($handle); } for ($i = 2; $i count($dir_array); $i++) { $xml_parser = xml_parser_create(UTF-8); xml_set_element_handler($xml_parser, startElement, endElement); xml_set_character_data_handler($xml_parser, characterData); if (!($fp = fopen($xml_repository.$dir_array[$i], r))) { die(could not open XML input); } while ($data = fread($fp, 4096)) { if ($hits = $MAXHITS) { echo pbover 100 hits!\n/b Stopping here./p; exit; } if (!xml_parse($xml_parser, $data, feof($fp))) { die(sprintf(XML error: %s at line %d, xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); } } xml_parser_free($xml_parser); } ? If I use $current_data = $data; I get nothing back at all, If I use $current_data .= $data; I get the concatenated response as expected but is not what I am after. All I want is the value of $data at that particular point in the parse. Any help much appreciated. -- Dan Field [EMAIL PROTECTED] Support Programmer: Cymru ar y we / Wales on the Web cy_GB: http://www.cymruarywe.org en_GB: http://www.walesontheweb.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Just Curious
On Sun, 2002-12-08 at 04:31, conbud wrote: I was just curious, but what program or website do you all use to view and reply to the newsgroups with ? Ximian Evolution 1.0.8 -- Dan Field Systems Development Officer - Social Services Dept. Ceredigion County Council. Mae'r neges ebost hon, ynghyd ag unrhyw ffeiliau sydd ynghlwm wrthi, yn gyfrinachol ac at ddefnydd yr unigolyn neu sefydliad y cyfeiriwyd hi ato. Pe dderbynioch y neges hon mewn camgymeriad, byddwch mor garedig a rhoi gwybod i'r rheolwr system. Mae'r nodyn hwn hefyd yn cadarnhau bod y neges ebost hon wedi cael ei archwilio am bresenoldeb feirws cyfrifiadurol gan MIMEsweeper. This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Overloading Constructors
is it doable? ie class myClass { var $myInt; // default constructor function myClass() { } // overloaded constructor function myClass($newInt) { $this-myInt = $newInt; } } -- Dan Field Systems Development Officer - Social Services Dept. Ceredigion County Council. Mae'r neges ebost hon, ynghyd ag unrhyw ffeiliau sydd ynghlwm wrthi, yn gyfrinachol ac at ddefnydd yr unigolyn neu sefydliad y cyfeiriwyd hi ato. Pe dderbynioch y neges hon mewn camgymeriad, byddwch mor garedig a rhoi gwybod i'r rheolwr system. Mae'r nodyn hwn hefyd yn cadarnhau bod y neges ebost hon wedi cael ei archwilio am bresenoldeb feirws cyfrifiadurol gan MIMEsweeper. This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Overloading Constructors
On Mon, 2002-11-25 at 10:57, Dan Field wrote: is it doable? well I found a way. It's a bit of a hack but FYI heres how it works: function Form() { // a slight hack which allows us to overload // constructors by the number of args $name = Form.func_num_args(); $arg_list = func_get_args(); $num_args = func_num_args(); switch($num_args) { case 0: $this-$name(); break; case 6: $this-$name( $arg_list[0], $arg_list[1], $arg_list[2], $arg_list[3], $arg_list[4], $arg_list[5]); break; default: echo Wrong number of args for constructor!; } } // pseudo-constructor for 0 args function Form0() { $this-formName = myForm; $this-formAction = $_SERVER['PHP_SELF']; $this-formMethod = POST; $this-formVersion = xhtml; $this-formLanguage = en_gb; $this-formStyle = /styles/form.css; $this-formElementCount = 0; } // pseudo-constructor for 6 args function Form6($formName, $formAction, $formMethod, $formVersion, $formLanguage, $formStyle) { $this-formName = $formName; $this-formAction = $formAction; $this-formMethod = $formMethod; $this-formVersion = $formVersion; $this-formLanguage = $formLanguage; $this-formStyle = $formStyle; $this-formElementCount = 0;// don't allow user to set this } -- Dan Field Systems Development Officer - Social Services Dept. Ceredigion County Council. Mae'r neges ebost hon, ynghyd ag unrhyw ffeiliau sydd ynghlwm wrthi, yn gyfrinachol ac at ddefnydd yr unigolyn neu sefydliad y cyfeiriwyd hi ato. Pe dderbynioch y neges hon mewn camgymeriad, byddwch mor garedig a rhoi gwybod i'r rheolwr system. Mae'r nodyn hwn hefyd yn cadarnhau bod y neges ebost hon wedi cael ei archwilio am bresenoldeb feirws cyfrifiadurol gan MIMEsweeper. This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Oracle 7 support
Can anyone tell me if Oracle 7 is supported by PHP 4.2.2 ? I have found functions specific to Oracle 8i and some more generic functions (are these only for Oracle 9?). Also, is there a doc containing all levels of support for 3rd party products? save me pestering the list in future. I couldn't locate it myself though. Many thanks, -- Dan Field Systems Development Officer - Social Services Dept. Ceredigion County Council. Mae'r neges ebost hon, ynghyd ag unrhyw ffeiliau sydd ynghlwm wrthi, yn gyfrinachol ac at ddefnydd yr unigolyn neu sefydliad y cyfeiriwyd hi ato. Pe dderbynioch y neges hon mewn camgymeriad, byddwch mor garedig a rhoi gwybod i'r rheolwr system. Mae'r nodyn hwn hefyd yn cadarnhau bod y neges ebost hon wedi cael ei archwilio am bresenoldeb feirws cyfrifiadurol gan MIMEsweeper. This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Oracle 7 support
On Tue, 2002-11-12 at 13:03, Ford, Mike [LSS] wrote: -Original Message- From: Dan Field [mailto:danf;ceredigion.gov.uk] Sent: 12 November 2002 12:18 Can anyone tell me if Oracle 7 is supported by PHP 4.2.2 ? Yes. I have found functions specific to Oracle 8i and some more generic functions (are these only for Oracle 9?). No -- the OCI8 functions are actually recommended for Oracle 7 upwards. The ora_* functions are older and do not use the newer OCI methodology. That is great news, thanks Mike. My second problem then lies with my current PHP Setup. I have been using the binary RPMs from RedHat up to now, which do not sem to have been compiled with the Oracle functionality included. If I recompile PHP, will I need the Oracle headers on the machine also? If so this could be a problem as the Oracle server I wish to use is not on the same machine as the webserver. Cheers -- Dan Field Systems Development Officer - Social Services Dept. Ceredigion County Council. Mae'r neges ebost hon, ynghyd ag unrhyw ffeiliau sydd ynghlwm wrthi, yn gyfrinachol ac at ddefnydd yr unigolyn neu sefydliad y cyfeiriwyd hi ato. Pe dderbynioch y neges hon mewn camgymeriad, byddwch mor garedig a rhoi gwybod i'r rheolwr system. Mae'r nodyn hwn hefyd yn cadarnhau bod y neges ebost hon wedi cael ei archwilio am bresenoldeb feirws cyfrifiadurol gan MIMEsweeper. This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Oracle 7 support
First, let me just say that I'm no Oracle guru. :) But while we're waiting for them... Thanks, all help appreciated :) *I think* you need to have Oracle installed even if you wouldn't really connect to it but instead connect to a different server. Since I installed Oracle with most of the Linux installations that I did, I haven't really tried enabling Oracle support in PHP without Oracle on the same server. In other words, I haven't really tried configuring --with-oci8 without supplying the path (e.g. --with-oci8=/path/to/oracle/ ). It certainly looks that way. PHP will look for the needed file when configuring so I don't think you can really get away without installing Oracle first. (Of course, you can just try to find out what files are needed, ask a friend to give you a copy, trick php that it exists, etc.--it might not work though...) Yes this is right too. I greabed the SRC RPM for PHP 4.2.2 and edited the spec file to include --with-oci8 but it now throws the following errors: checking for Oracle-OCI8 support... yes, shared checking Oracle Install-Dir... checking Oracle version... configure: error: Oracle-OCI8 needed libraries not found error: Bad exit status from /var/tmp/rpm-tmp.47391 (%build) Anyway, if you need Oracle, try the OTN site. There's one that you can use for development. Luckally I had downloaded the Oracle-Linux (Version 8i) installer a few weeks ago incase this problem arised. but the installer is currently taking 98% of my CPU with the Java Runtime and it doesn't seem to be doing a lot else (not even a GUI window yet . 20 minutes later). I fear this is too OT for the list though. If anyone does know if I can trick PHP by just copying some files from the Oracle-Linux.tar then this would be a great help though. Thanks all for your support. -- Dan Field Systems Development Officer - Social Services Dept. Ceredigion County Council. Mae'r neges ebost hon, ynghyd ag unrhyw ffeiliau sydd ynghlwm wrthi, yn gyfrinachol ac at ddefnydd yr unigolyn neu sefydliad y cyfeiriwyd hi ato. Pe dderbynioch y neges hon mewn camgymeriad, byddwch mor garedig a rhoi gwybod i'r rheolwr system. Mae'r nodyn hwn hefyd yn cadarnhau bod y neges ebost hon wedi cael ei archwilio am bresenoldeb feirws cyfrifiadurol gan MIMEsweeper. This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php