[PHP] XML Parse Syntax Error
I am working on an XML parser and trying to learn about them. All the scripts I get from the net in various tutorials and such all return nothing but XML error: syntax error at line 1. I checked the variables with PHPINFO() and it says that XML support is on. I also know that keeping the PHP up to date is not a priority around here as we are still on PHP3. Any thoughts on what this might be? Is the server jsut showing it's need for an update again? -tom here is one example of the code I am using: $xml_file = data.xml; echo table border=0 cellpadding=5; echo trth colspan=2XML Articles/th/tr; function startElement($parser_instance, $element_name, $attrs) { switch($element_name) { case URL :echo trtda href=\; break; case SUMMARY :echo td; break; } } function characterData($parser_instance, $xml_data) { echo $xml_data; } function endElement($parser_instance, $element_name) { switch($element_name) { case URL :echo \; break; case TITLE :echo /a/td; break; case SUMMARY :echo /td/tr; break; } } $parser = xml_parser_create(); xml_set_element_handler($parser, startElement, endElement); xml_set_character_data_handler($parser, characterData); if (!($filehandler = fopen($xml_file, r))) { die(could not open XML input); } while ($data = fread($filehandler, 4096)) { if (!xml_parse($parser, $data, feof($filehandler))) { die(sprintf(XML error: %s at line %d, xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser))); } } fclose($filehandler); xml_parser_free($parser); echo /table; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mail() Not working right
I am trying to get the mail() function to work right on my system and while I get no PHP errors the mail is never sent. Running on a linux server with PHP3 and I have confirmed that the command line mail function does work along with a few perl scripts that send mail as well. Here is the code I am using ? mail([EMAIL PROTECTED], testing 1234, this is a test message); ? -thanks tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail() Not working right
I just found out that the server taht I though was running sendmail is in fact running another program (communigate). I think php is just not interfacing with it correctly. I know this is kinda off topic but is there anyway to monitor what is being sent back to the system from the PHP command, like ECHO? Maybe that way I can see what is going on -tom Jason Wong wrote: On Friday 13 December 2002 04:00, Tom Culpepper wrote: I am trying to get the mail() function to work right on my system and while I get no PHP errors the mail is never sent. Running on a linux server with PHP3 and I have confirmed that the command line mail function does work along with a few perl scripts that send mail as well. Here is the code I am using ? mail([EMAIL PROTECTED], testing 1234, this is a test message); ? If you get no php errors, try looking at your mailserver logs. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Mail() Not working right
I actaully already wrote one like that. The PHP is going fine, the problem I believe is PHP interfacing with my mail server. Thanks though Steve Yates wrote: Tom Culpepper [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... while I get no PHP errors the mail is never sent. mail([EMAIL PROTECTED], testing 1234, this is a test message); I don't think this shows an error if it doesn't work. Try $mailsuccess = mail(...); if (!$mailsuccess) { echo oops; } - Steve Yates - How often should we practice sex before it is safe? ~ Taglines by Taglinator - www.srtware.com ~ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How To get the Time Zone of the visitor?
You can get the IP using getenv() (http://www.php.net/manual/nl/function.getenv.php) not sure how you would get the time zone though. -tom culpepper Jacob Mangalyajyothy wrote: Hi All, I would lik eto get the information about the location of the visitors to my site like From which IP, What browser and which part of the world etc. How can get the information about the location of the visitor, using PHP? for me, the time zone is sufficient. Thanks in advance. Jacob Joseph. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How To get the Time Zone of the visitor?
Found this tutorial that might be helpful http://martin.f2o.org/php/localtime -tom Jacob Mangalyajyothy wrote: Hi All, I would lik eto get the information about the location of the visitors to my site like From which IP, What browser and which part of the world etc. How can get the information about the location of the visitor, using PHP? for me, the time zone is sufficient. Thanks in advance. Jacob Joseph. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php bugs (Chinese word display problem)-help
I am not positive of the problem as I can not see your code, but if you want to display the words that end in '5C' the you can do them like so: \(escape character) like this: \(95 5C 5C) If you could sttach some code we might have a better idea. -tom culpepper [EMAIL PROTECTED] wrote: Hi, everyone: I am a Chinese, I am a programmer. I encounter a problem about php. Attachment is 1.php, when i open this file (this file is saved at linux server, apache and php 4.2.3 are installed on this server) in Internet Explorer, error displays: Parse error: parse error, expecting `','' or `';'' in /usr/3give/test/1.php on line 5 (If your computer is windows 2000, and Simplify Chinese and Traditional chinese language are installed) you will read the Chinese word. I found that if the hex code for Chinese word ends with '5C', then the error will exist. Anymore, if I input a Chinese word which hex code ends with '5C' in the database field, then the display result will add a suffix '\', for example, if i input ÖÐß\, it will display ÖÐß\\ at the browser (Internet explorer). I don't know why this problem exist, can you solve this problem for us? Contact me by: [EMAIL PROTECTED]; (86)755-27232311-samuel Best regards Thanks. Samuel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Invalid Charactors in a string.
lookup ereg() and eregi() -tom culpepper Philip J. Newman wrote: Where should i start, tips wanted. I would like to check a username string for valid charactors before the name is processed. Someone point me in the right direction please --- Philip J. Newman. Head Developer. PhilipNZ.com New Zealand Ltd. http://www.philipnz.com/ [EMAIL PROTECTED] Mob: +64 (25) 6144012. Tele: +64 (9) 5769491. VitalKiwi Site: Philip J. Newman Internet Developer http://www.newman.net.nz/ [EMAIL PROTECTED] * Friends are like Stars, You can't always see them, But you know they are there. * ICQ#: 20482482 MSN ID: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] AIM: newmanpjkiwi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Php search results]
I wrote this function to fetch a news item off another web page but with a little modification it should work for you. To use it you needed to identify a set of of strings in the source to use as anchors ($start, $end) and then it pulls that section and crops off the anchor text so you are left with just what you wanted. ? function get_item($url, $start, $end) { global $item; if(!($fp=fopen($url,r))) { echo $url. is not accessable; exit; } while(!feof($fp)) { $item.=fgets($fp,255); } fclose($fp); $start_position=strpos($item, $start)+strlen($start); $end_position=strpos($item, $end); $length=$end_position-$start_position; $item=substr($item, $start_position, $length); } echo $item; ? Soemthing like this might work for you: ? $results=search results; $keyword=search string; $startposition=strpos($results, $keyword)-200; $endposition=strpos($results, $keyword)+200; $length=$endposition-$startposition; $item=substr($item, $startposition, $length; echo $item ? Tom Culpepper www.multicasttech.com [EMAIL PROTECTED] Alex wrote: you could also use regular expressions, but php isn't perl, so good luck on that one :p. Philip Hallstrom [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... You could use strstr() to find the index location of the string searched for in FIELD. Then use substr() to return say 50 characters on either side... -philip On Thu, 21 Nov 2002, Daniel Masson wrote: Hello everyone ... Im working on some kind of search engine for two little tables on text fields on mssql, and the text fields can be very large fields, im doing the search with SELECT FIELD FROM TABLE WHERE FIELD LIKE '%SOMTHING%' .. My question is: When displaying the search results i dont want to display the entire field, only the specific parts where the keyword was found , and bold for the keyword and i just dony know how to to do that, i mean displaying the keyword in bold is no problem .. I need to know how to display only the parts where this keyword is. Any help will be very helpful Thanks every1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] grabbing data from a site
Try this function, Ijust wrote it for the same purpose. You just need a unique string in front of the stuff you want, and one after it. You can usually get a string of code on either end that will do this. The function will open the URL, find the anchor strings you told it, then strip them away leaving only the text/code that was in between them ? function get_item($url, $start, $end) { global $item; if(!($fp=fopen($url,r))) { echo $url. is not accessable; exit; } while(!feof($fp)) { $item.=fgets($fp,255); } fclose($fp); $start_position=strpos($item, $start)+strlen($start); $end_position=strpos($item, $end); $length=$end_position-$start_position; $item=substr($item, $start_position, $length); } echo $item; ? Tom Culpepper Multicast Technologies Adam wrote: someone gave me the following expression which uses another program and it works fine for them... is there something similar with php? wget --timeout=90 -q -O- http://www.BoM.GOV.AU/products/IDO30V01.shtml | sed '1,/Melbourne sup/d' | sed '1d;3,$d;s/.*//;s/.*//' thanks, adam. Evan Nemerson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 If the target is in well-formed XML (XHTML is an example), you could use XSLT to say 'i want the third column of a particular row - in this instance, Melbourne'. However, since few people actually adhere to standards, you're probably going to need a regex... if you're not comfortable with them, explode() could be useful (although it is slower) Somebody posted an extremely helpfull little quick reference at php.net/ereg, i think... that might help you. On Friday 22 November 2002 01:40 pm, Adam wrote: I have the following website that i want to grab info from: http://www.bom.gov.au/products/IDV60034.shtml Say I wanted the current temperature for Melbourne from this table, what line of code would I need to tell it to get that info - ie, an ereg() expression... i'm wondering whether there are ways of saying i want the third column of a particular row - in this instance, Melbourne? Thanks for any help. Adam. - -- I pledge allegiance to the flag, of the United States of America, and to the republic for which it stands, one nation indivisible, with liberty, and justice for all. - -Pledge of Allegiance -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE93qVm/rncFku1MdIRAshSAJ9phj0DqR3seanlzKXhdnKj8cvI8QCfW7kM tfUfUEF4yVJSRnm0GCkIeaM= =AyI1 -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] put result of include into a variable
Try using fopen() to open the file and then fread() to read it into the buffer and set that equal to the variable. Tom Culpepper Multicast Technologies Patrick Anderson at TUE wrote: Hi, For some (strange, I know) reason I would like to copy the content of a webpage into a database. I would like to have code like $whocares = include (http://www.microsoft.nl;); $query = insert into html values ($whocares,...); .. However, include can not copy the content to a variable. Does anyone have an idea how to circumvent this problem? Thanks, Patrick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse URLs
not entirely sure what is going on there, but if the user is entering the url in a html form. Then just grab the variable on the next page and run this $url=user $HTTP_GET_VARS[url]; (or $HTTP_POST_VARS depending on your form method) $url=a href=.$url..$url./a; echo $url; the only way to change it dynamically on the same page would be javascript. -tom culpepper Stephen wrote: I have a simple post script and I want to make it so if a user types in a URL of some sort, to change it to make it clickable. How could I do that? Thanks, Stephen Craton http://www.melchior.us Life is a gift from God. Wasting it is like destroying a gift you got from the person you love most. -- http://www.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse URLs
from the archives of the list http://www.phpbuilder.com/mail/php-windows/2001042/0222.php -tom culpepper Stephen wrote: They are entering in a whole paragraph or two of text and I want to search the paragraph for URLs then make it a clickable URL and then store it in a MySQL database. - Original Message - From: Tom Culpepper [EMAIL PROTECTED] To: Stephen [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, November 23, 2002 9:05 PM Subject: Re: [PHP] Parse URLs not entirely sure what is going on there, but if the user is entering the url in a html form. Then just grab the variable on the next page and run this $url=user $HTTP_GET_VARS[url]; (or $HTTP_POST_VARS depending on your form method) $url=a href=.$url..$url./a; echo $url; the only way to change it dynamically on the same page would be javascript. -tom culpepper Stephen wrote: I have a simple post script and I want to make it so if a user types in a URL of some sort, to change it to make it clickable. How could I do that? Thanks, Stephen Craton http://www.melchior.us Life is a gift from God. Wasting it is like destroying a gift you got from the person you love most. -- http://www.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php