[PHP] Help! Having trouble getting one XML field from this feed reliably
Can anyone tell me what I'm doing wrong here? I'm trying to get the VASTAdTagURI field from the XML data at this url: http://afe.specificclick.net/?l=32259t=xrnd=123456 Here's my code. (below). It works maybe 30% of the time, but most of the time it just returns nothing from that field. Yet when I go to the above url in Firefox, I always see the data. This is very strange. // Lets get the ad! $curl_handle=curl_init(); curl_setopt($curl_handle,CURLOPT_URL,'http://afe.specificclick.net/?l=32259t=xrnd=123456'); curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2); curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1); $buffer = curl_exec($curl_handle); curl_close($curl_handle); $vastdata = new SimpleXMLElement($buffer); $vasturi = $vastdata-Ad-Wrapper-VASTAdTagURI; echo If the script works, vasturi = . $vasturi; echo brbrbr; print_r($vastdata); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Looking for PHP/JS/MySQL gurus in the Northern VA area
Can anyone tell me if there are folks on this list in the Northern VA area? I need to find a freelancer who knows PHP, Javascript, and mySQL. My client likes face-to-face meetings on occasion, so I really need someone local. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Server-side postscript-to-PDF on-the-fly conversion
Is there a free solution out there that will enable me to take a PHP-generated postscript output file, and dynamically, on-the-fly convert it to a PDF document and send to the user as a download when the user clients on a link? More description of what I'm trying to do: 1) I've got a web-page that accepts some user input 2) They hit SUBMIT 3) I've got a PHP file that takes that input and generates a custom Postscript file from it, which I presently serve back to the user. On a Mac, Safari and Firefox automatically take the .ps output and render it in Preview. 4) However, in the world of Windows, it seems like it'd be better to just convert it on-the-fly into a PDF, so that the user doesn't need to worry about having a post-script viewer app installed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP to access shell script to print barcodes
I love the idea of using PHP to insert data into Postscript. I'm just not sure how to make it happen. The good news is that I've got barcodes drawing just the way I need them: http://www.winecarepro.com/kiosk/fast/shell/barcodemerge.ps The bad news is that's all hard-coded Postscript. I'd like to take your suggestion and use PHP to loop-through and draw the barcodes - - - however, if I put anything that resembles PHP in my .ps file, bad things happen. Anyone know the secret to creating a postscript .ps file that had PHP code injecting data into it? Here's the source file that works. Where PHP would be handy is at the very bottom of the script http://www.winecarepro.com/kiosk/fast/shell/barcodemerge.ps.zip On Mar 23, 2010, at 7:48 AM, Richard Quadling wrote: On 23 March 2010 05:48, Jochem Maas joc...@iamjochem.com wrote: Op 3/23/10 3:27 AM, Rob Gould schreef: I am trying to replicate the functionality that I see on this site: http://blog.maniac.nl/webbased-pdf-lto-barcode-generator/ Notice after you hit SUBMIT QUERY, you get a PDF file with a page of barcodes. That's _exactly_ what I'm after. Fortunately, the author gives step-by-step instructions on how to do this on this page: http://blog.maniac.nl/2008/05/28/creating-lto-barcodes/ So I've gotten through all the steps, and have created the barcode_with_samples.ps file, and have it hosted here: http://www.winecarepro.com/kiosk/fast/shell/ Notice how the last few lines contain the shell-script that renders the postscript: #!/bin/bash BASE=”100″; NR=$BASE for hor in 30 220 410 do ver=740 while [ $ver -ge 40 ]; do printf -v FNR “(%06dL3)” $NR echo “$hor $ver moveto $FNR (includetext height=0.55) code39 barcode” let ver=$ver-70 let NR=NR+1 done done I need to somehow create a PHP script that executes this shell script. And after doing some research, it sounds like I need to use the PHP exec command, so I do that with the following file: http://www.winecarepro.com/kiosk/fast/shell/printbarcodes.php Which has the following script: ?php $command=http://www.winecarepro.com/kiosk/fast/shell/barcode_with_sample.ps;; exec($command, $arr); echo $arr; ? And, as you can see, nothing works. I guess firstly, I'd like to know: A) Is this PHP exec call really the way to go with executing this shell script? Is there a better way? It seems to me like it's not really executing. that's what exec() is for. $command need to contain a *local* path to the command in question, currently your trying to pass a url to bash ... which obviously doesn't do much. the shell script in question needs to have the executable bit set in order to run (either that or change to command to run bash with your script as an argument) I'd also suggest putting the shell script outside of your webroot, or at least in a directory that's not accessable from the web. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I think this is a translation of the script to PHP. ?php $BASE = 100; $NR = $BASE; foreach(array(30, 220, 410) as $hor) { $ver = 740; while ($ver = 40) { printf($hor $ver moveto (%06dL3) (includetext height=0.55) code39 barcode\n, $NR); $ver -= 70; ++$NR; } } It produces output like ... 30 740 moveto (000100L3) (includetext height=0.55) code39 barcode 30 670 moveto (000101L3) (includetext height=0.55) code39 barcode 30 600 moveto (000102L3) (includetext height=0.55) code39 barcode 30 530 moveto (000103L3) (includetext height=0.55) code39 barcode 30 460 moveto (000104L3) (includetext height=0.55) code39 barcode 30 390 moveto (000105L3) (includetext height=0.55) code39 barcode 30 320 moveto (000106L3) (includetext height=0.55) code39 barcode 30 250 moveto (000107L3) (includetext height=0.55) code39 barcode 30 180 moveto (000108L3) (includetext height=0.55) code39 barcode 30 110 moveto (000109L3) (includetext height=0.55) code39 barcode 30 40 moveto (000110L3) (includetext height=0.55) code39 barcode 220 740 moveto (000111L3) (includetext height=0.55) code39 barcode 220 670 moveto (000112L3) (includetext height=0.55) code39 barcode 220 600 moveto (000113L3) (includetext height=0.55) code39 barcode 220 530 moveto (000114L3) (includetext height=0.55) code39 barcode 220 460 moveto (000115L3) (includetext height=0.55) code39 barcode 220 390 moveto (000116L3) (includetext height=0.55) code39 barcode 220 320 moveto (000117L3) (includetext height=0.55) code39 barcode 220 250 moveto (000118L3) (includetext height=0.55) code39 barcode 220 180 moveto (000119L3) (includetext height=0.55) code39 barcode 220 110 moveto (000120L3) (includetext height=0.55) code39 barcode 220 40 moveto (000121L3) (includetext height=0.55) code39 barcode 410 740 moveto (000122L3) (includetext height=0.55) code39 barcode 410
Re: [PHP] PHP to access shell script to print barcodes
Well, that did something, and it does sound like it should work. I've scoured the web and haven't found anyone with code that does what I'm trying to do. I've got a working, hardcoded Postscript file here: http://www.winecarepro.com/kiosk/fast/shell/barcodemerge.ps But I need to somehow serve it with PHP, so I can change some variables in it. By putting headers in place with PHP, and then doing an echo of the postscript, I get postscript errors (though Preview doesn't tell me what the error is): http://www.winecarepro.com/kiosk/fast/shell/serverps.ps Trying to trick the web-browser into thinking it's receiving Postscript from a PHP file is tricky. I don't know what to do next. Here's the code I was using in the above url: http://www.winecarepro.com/kiosk/fast/shell/serveps.php.zip It's not clear to me if the server is parsing the postscript first and then serving it, or if the server is server the postscript as-is and the browser sends it to Preview which interprets it. I basically want to replicate the functionality found here: http://blog.maniac.nl/webbased-pdf-lto-barcode-generator/ On Mar 23, 2010, at 5:37 PM, Peter Lind wrote: You can create a .php script that sets a proper header to make the browser download the file rather than display it. That also allows you to set the filename for the download. What you'd need to do is include something like: header(Content-Disposition: attachment; filename: 'barcodemerge.ps'); That tells the browser to download the file. You can also try setting the content-type header('Content-type: application/postscript'); Either of the above might do the trick for you. Regards Peter On 23 March 2010 22:10, Rob Gould gould...@me.com wrote: I love the idea of using PHP to insert data into Postscript. I'm just not sure how to make it happen. The good news is that I've got barcodes drawing just the way I need them: http://www.winecarepro.com/kiosk/fast/shell/barcodemerge.ps The bad news is that's all hard-coded Postscript. I'd like to take your suggestion and use PHP to loop-through and draw the barcodes - - - however, if I put anything that resembles PHP in my .ps file, bad things happen. Anyone know the secret to creating a postscript .ps file that had PHP code injecting data into it? Here's the source file that works. Where PHP would be handy is at the very bottom of the script http://www.winecarepro.com/kiosk/fast/shell/barcodemerge.ps.zip On Mar 23, 2010, at 7:48 AM, Richard Quadling wrote: On 23 March 2010 05:48, Jochem Maas joc...@iamjochem.com wrote: Op 3/23/10 3:27 AM, Rob Gould schreef: I am trying to replicate the functionality that I see on this site: http://blog.maniac.nl/webbased-pdf-lto-barcode-generator/ Notice after you hit SUBMIT QUERY, you get a PDF file with a page of barcodes. That's _exactly_ what I'm after. Fortunately, the author gives step-by-step instructions on how to do this on this page: http://blog.maniac.nl/2008/05/28/creating-lto-barcodes/ So I've gotten through all the steps, and have created the barcode_with_samples.ps file, and have it hosted here: http://www.winecarepro.com/kiosk/fast/shell/ Notice how the last few lines contain the shell-script that renders the postscript: #!/bin/bash BASE=”100″; NR=$BASE for hor in 30 220 410 do ver=740 while [ $ver -ge 40 ]; do printf -v FNR “(%06dL3)” $NR echo “$hor $ver moveto $FNR (includetext height=0.55) code39 barcode” let ver=$ver-70 let NR=NR+1 done done I need to somehow create a PHP script that executes this shell script. And after doing some research, it sounds like I need to use the PHP exec command, so I do that with the following file: http://www.winecarepro.com/kiosk/fast/shell/printbarcodes.php Which has the following script: ?php $command=http://www.winecarepro.com/kiosk/fast/shell/barcode_with_sample.ps;; exec($command, $arr); echo $arr; ? And, as you can see, nothing works. I guess firstly, I'd like to know: A) Is this PHP exec call really the way to go with executing this shell script? Is there a better way? It seems to me like it's not really executing. that's what exec() is for. $command need to contain a *local* path to the command in question, currently your trying to pass a url to bash ... which obviously doesn't do much. the shell script in question needs to have the executable bit set in order to run (either that or change to command to run bash with your script as an argument) I'd also suggest putting the shell script outside of your webroot, or at least in a directory that's not accessable from the web. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I think this is a translation of the script to PHP. ?php $BASE = 100; $NR = $BASE; foreach(array(30, 220, 410) as $hor) { $ver = 740
[PHP] PHP or SQL to do this?
I'm not sure if I need to write a PHP for-loop to do this, or if it can all be done in one SQL statement? Basically, I want to copy all the barcodes from one table and put them into another table, but only if the barcode in the first table 0, and only if the wineid's match from table to table. Steps individually are something like this: 1) First, I get all the records from the wine table that have barcodes, like this: SELECT * FROM `wine` WHERE barcode2 0 The fields I need are barcode2, and wineid 2) Next, I need to match all the wineid's from this wine table with the wine id's from the usersdata table. Both fields in both tables are called wineid. 3) Then, if the wineid's match, I need to copy the barcode2 value from the wine table and put it into the field custombarcode in the usersdata table. I'm tempted to write a PHP script which does a while-loop through all the records returned from the wine table and do the matching with the usersdata table, but I wouldn't be surprised if there's some sort of table-join-type query that can do all this in one step. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help with preg_replace pattern
It appears that IE renders it's display: none in all caps while Firefox and other browsers pass it back in lowercase. This throws off my php line of code the is supposed to nuke blank bullets from a string of text: $bl = LI style=DISPLAY: none id=bullet_ug2_col5_8/LI LI style=DISPLAY: none id=bullet_ug2_col4_8/LI LI style=DISPLAY: none id=bullet_ug2_col3_8/LI LI style=DISPLAY: none id=bullet_ug2_col2_8/LI LI style=DISPLAY: none id=bullet_ug2_8/LI LI style=DISPLAY: none id=bullet_ug1_col4_8/LI LI style=DISPLAY: list-item id=bullet_ug1_col3_8Reserved Frontstretch Tower Ticket to the NextEra Energy Resources 250 on Friday Night /LI LI style=DISPLAY: list-item id=bullet_ug1_col2_8Reserved Frontstretch Tower Ticket to the Camping World 300 on Saturday /LI LI style=DISPLAY: list-item id=bullet_2_8Reserved Frontstretch Tower Ticket to the Daytona 500 on Sunday /LI LI style=DISPLAY: none id=bullet_addon_col2_8/LI LI style=DISPLAY: none id=bullet_addon3_8/LI LI style=DISPLAY: none id=bullet_option2_col4_8/LI LI style=DISPLAY: none id=bullet_option2_col3_8/LI LI style=DISPLAY: none id=bullet_option2_col2_8/LI LI style=DISPLAY: none id=bullet_option2_col1_8/LI LI style=DISPLAY: none id=bullet_option3_col4_8/LI LI style=DISPLAY: none id=bullet_option3_col3_8/LI LI style=DISPLAY: none id=bullet_option3_col2_8/LI LI style=DISPLAY: none id=bullet_option3_col1_8/LI LI style=DISPLAY: none id=bullet_option4_col4_8/LI LI style=DISPLAY: none id=bullet_option4_col3_8/LI I want to keep the DISPLAY: list-item lines, and nuke all the others. The below above are sent to PHP in a variable called $bl. I then try to nuke the DISPLAY: none lines with something like: $pattern = '/li[^]*style=display: none[^]*/'; $bl = preg_replace($pattern,'',$bl); $pattern = '/li[^]*style=DISPLAY: none[^]*/'; $bl = preg_replace($pattern,'',$bl); But it appears that the case-sensitivity fix is not just a matter of making the letter capitals. I'm sure someone who knows more than I about preg_replace will see the immediate error of my ways. Any advice is greatly appreciated.
[PHP] Re: UrlRewrite htaccess confusion
You are indeed correct! Absolute URLs for everything, images, css, javascript, and links fixed the issue. Took me forever to change every link in the whole site, but it's happy now. Seems like there ought to be an easier way. On Oct 29, 2009, at 10:52 AM, Shawn McKenzie wrote: Rob Gould wrote: I feel like I'm really close to a solution for the clean-url method in htaccess. I've successfully got it now so that: http://benchwarmersports.com/packages/basketball/2010/nba-all-star-game maps to: http://benchwarmersports.com/packages.php?category=basketballyear=2010title=nba-all-star-game However, I'm finding that when I click on subsequent links from: http://benchwarmersports.com/packages/basketball/2010/nba-all-star-game that I land in a strange url-structure where it replicates the packages part of the url. Can someone tell me what I might need to change about my rewrite logic to fix this issue? I'm getting lost in the world of base urls and recursive rewrites... It's hard to tell without seeing the link and/or what code you use to generate it, but off the top of my head I would say that it's not a rewrite issue. It seems to be an issue with using relative URLs in your links. If you are on this page (this is in your browser address bar): http://benchwarmersports.com/packages.php?category=basketballyear=2010title=nba-all-star-game The browser will interpret all relative links like 'somefile.php' as: http://benchwarmersports.com/somefile.php But if you use your rewritten URL, then the browser will see relative links as one of the following (not sure which without testing): http://benchwarmersports.com/packages/basketball/2010/nba-all-star-game/somefile.php --or-- http://benchwarmersports.com/packages/basketball/2010/somefile.php This is because it is interpreting the slashes as path separators. You probably need to generate absolute URLs in your links. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] UrlRewrite htaccess confusion
I feel like I'm really close to a solution for the clean-url method in htaccess. I've successfully got it now so that: http://benchwarmersports.com/packages/basketball/2010/nba-all-star-game maps to: http://benchwarmersports.com/packages.php?category=basketballyear=2010title=nba-all-star-game However, I'm finding that when I click on subsequent links from: http://benchwarmersports.com/packages/basketball/2010/nba-all-star-game that I land in a strange url-structure where it replicates the packages part of the url. Can someone tell me what I might need to change about my rewrite logic to fix this issue? I'm getting lost in the world of base urls and recursive rewrites... Present htaccess code: Options +FollowSymlinks RewriteEngine On RewriteOptions MaxRedirects=10 RewriteBase / RewriteRule ^packages/([^/]+)/([^/]+)/([^/]+)$ /packages.php?category= $1year=$2title=$3 [NC] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RewriteRule to hide PHP vars in URL
I'm trying to follow the RewriteRule docs to make it so that: http://benchwarmersports.com/packages/super-bowl-xliv/1 can be entered into the web-browser, and it transforms into: http://benchwarmersports.com/packages.php?title=super-bowl-xliveventid=1 The good news is that it does transform the url when I do this. The bad news is that it also attempts to transform all the links (including to JS files and images). Can someone tell me what I'd need to modify to avoid this problem with the RewriteRule? My .htaccess file presently looks like this: Options +FollowSymlinks RewriteEngine On RewriteOptions MaxRedirects=10 RewriteBase / RewriteRule ^packages/([^/]+)/([^/]+)$ /packages.php?title= $1eventid=$2 [NC] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RewriteRule to hide PHP vars in URL
Isn't there a way to tell the Rewrite rule to skip anything found in a js or images subfolder? On Oct 25, 2009, at 12:26 PM, Ashley Sheridan wrote: On Sun, 2009-10-25 at 11:04 -0400, Rob Gould wrote: I'm trying to follow the RewriteRule docs to make it so that: http://benchwarmersports.com/packages/super-bowl-xliv/1 can be entered into the web-browser, and it transforms into: http://benchwarmersports.com/packages.php?title=super-bowl-xliveventid=1 The good news is that it does transform the url when I do this. The bad news is that it also attempts to transform all the links (including to JS files and images). Can someone tell me what I'd need to modify to avoid this problem with the RewriteRule? My .htaccess file presently looks like this: Options +FollowSymlinks RewriteEngine On RewriteOptions MaxRedirects=10 RewriteBase / RewriteRule ^packages/([^/]+)/([^/]+)$ /packages.php?title= $1eventid=$2 [NC] It's because in your HTML the URL's to the JS and images are relative. Changing them to absolute should fix the problem Thanks, Ash http://www.ashleysheridan.co.uk
[PHP] How to take output from an include, and embed it into a variable?
I have an invoice table that is drawn on a number of pages, so I have all the logic in an include-file like this: include invoicetable_bottom.php; However, now I'm needing to take the output from that include file and pass it as an email. To do that, I need to somehow take the output from this include file and get it into a variable somehow. Is there a simple way to do this? Something like: $emailtcontent = include invoicetable_bottom.php? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] use preg_replace to nix and line with display: none
I wish I could say this works, but I'm not having success with this pattern. All the lines with display: none are still in the $bl string. On Aug 9, 2009, at 1:50 AM, LinuxManMikeC wrote: li id=bullet_ug1_col2_9 style=display: list-item;Reserved Frontstretch Tower Ticket to the Camping World 300 on Saturday /li li id=bullet_2_9 style=display: list-item;Reserved Frontstretch Tower Ticket to the Daytona 500 on Sunday /li li id=bullet_addon_col2_9 style=display: none;/ li id=bullet_addon3_9 style=display: none;/ li id=bullet_option2_col4_9 style=display: none;/ li id=bullet_option2_col3_9 style=display: none;/ li id=bullet_option2_col2_9 style=display: none;/ li id=bullet_option2_col1_9 style=display: none;/ li id=bullet_option3_col4_9 style=display: none;/ li id=bullet_option3_col3_9 style=display: none;/ li id=bullet_option3_col2_9 style=display: none;/ li id=bullet_option3_col1_9 style=display: none;/ li id=bullet_option4_col4_9 style=display: none;/ li id=bullet_option4_col3_9 style=display: none;/ li id=bullet_option4_col2_9 style=display: none;/ li id=bullet_option4_col1_9 style=display: none;/ li id=bullet_option5_col4_9 style=display: none;/ li id=bullet_option5_col3_9 style=display: none;/ li id=bullet_option5_col2_9 style=display: none;/ li id=bullet_option5_col1_9 style=display: none;/ li id=bullet_5_9Official Daytona 500 Race Week Program /li li id=bullet_6_9Benchwarmer Sports Souvenir Ticket Protector and Lanyard /li li id=bullet_7_9On Site Benchwarmer Tour Staff /li li id=bullet_8_9All Taxes and Service Charges/li I'm CLOSE, but since the style = display:[space]none my preg_replace doesn't catch it. Can anyone help me determine the correct preg_replace pattern to do this? $bl = $_POST['bulletlist']; $pattern = '|^.+?display:none.+?$|mi'; $bl = preg_replace($pattern,'',$bl); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I found your use of ? rather... creative... Anyway, just add the condition 0 or more whitespace to your regex. $pattern = '|^.+display:\w*none.+$|'; I found your use of ? rather... creative... Anyway, just add the condition 0 or more whitespace to your regex. $pattern = '|^.+display:\w*none.+$|';
Re: [PHP] use preg_replace to nix and line with display: none
Yay! That worked. Thanks! On Aug 9, 2009, at 1:53 AM, Michael A. Peters wrote: Rob Gould wrote: I have a bunch of bullets in a list coming from a previous post, and I need to eliminate any line from this string that contains display: none li id=bullet_ug1_col2_9 style=display: list-item;Reserved Frontstretch Tower Ticket to the Camping World 300 on Saturday /li li id=bullet_2_9 style=display: list-item;Reserved Frontstretch Tower Ticket to the Daytona 500 on Sunday /li li id=bullet_addon_col2_9 style=display: none;/ li id=bullet_addon3_9 style=display: none;/ li id=bullet_option2_col4_9 style=display: none;/ li id=bullet_option2_col3_9 style=display: none;/ li id=bullet_option2_col2_9 style=display: none;/ li id=bullet_option2_col1_9 style=display: none;/ li id=bullet_option3_col4_9 style=display: none;/ li id=bullet_option3_col3_9 style=display: none;/ li id=bullet_option3_col2_9 style=display: none;/ li id=bullet_option3_col1_9 style=display: none;/ li id=bullet_option4_col4_9 style=display: none;/ li id=bullet_option4_col3_9 style=display: none;/ li id=bullet_option4_col2_9 style=display: none;/ li id=bullet_option4_col1_9 style=display: none;/ li id=bullet_option5_col4_9 style=display: none;/ li id=bullet_option5_col3_9 style=display: none;/ li id=bullet_option5_col2_9 style=display: none;/ li id=bullet_option5_col1_9 style=display: none;/ li id=bullet_5_9Official Daytona 500 Race Week Program /li li id=bullet_6_9Benchwarmer Sports Souvenir Ticket Protector and Lanyard /li li id=bullet_7_9On Site Benchwarmer Tour Staff /li li id=bullet_8_9All Taxes and Service Charges/li I'm CLOSE, but since the style = display:[space]none my preg_replace doesn't catch it. Can anyone help me determine the correct preg_replace pattern to do this? $bl = $_POST['bulletlist']; $pattern = '|^.+?display:none.+?$|mi'; $bl = preg_replace($pattern,'',$bl); Easy to do with xml tools if your input is easily manipulated by xml tools, but try this: $pattern = '/li[^]*style=display: none[^]*/'; not tried myself. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] use preg_replace to nix and line with display: none
I have a bunch of bullets in a list coming from a previous post, and I need to eliminate any line from this string that contains display: none li id=bullet_ug1_col2_9 style=display: list-item;Reserved Frontstretch Tower Ticket to the Camping World 300 on Saturday /li li id=bullet_2_9 style=display: list-item;Reserved Frontstretch Tower Ticket to the Daytona 500 on Sunday /li li id=bullet_addon_col2_9 style=display: none;/ li id=bullet_addon3_9 style=display: none;/ li id=bullet_option2_col4_9 style=display: none;/ li id=bullet_option2_col3_9 style=display: none;/ li id=bullet_option2_col2_9 style=display: none;/ li id=bullet_option2_col1_9 style=display: none;/ li id=bullet_option3_col4_9 style=display: none;/ li id=bullet_option3_col3_9 style=display: none;/ li id=bullet_option3_col2_9 style=display: none;/ li id=bullet_option3_col1_9 style=display: none;/ li id=bullet_option4_col4_9 style=display: none;/ li id=bullet_option4_col3_9 style=display: none;/ li id=bullet_option4_col2_9 style=display: none;/ li id=bullet_option4_col1_9 style=display: none;/ li id=bullet_option5_col4_9 style=display: none;/ li id=bullet_option5_col3_9 style=display: none;/ li id=bullet_option5_col2_9 style=display: none;/ li id=bullet_option5_col1_9 style=display: none;/ li id=bullet_5_9Official Daytona 500 Race Week Program /li li id=bullet_6_9Benchwarmer Sports Souvenir Ticket Protector and Lanyard /li li id=bullet_7_9On Site Benchwarmer Tour Staff /li li id=bullet_8_9All Taxes and Service Charges/li I'm CLOSE, but since the style = display:[space]none my preg_replace doesn't catch it. Can anyone help me determine the correct preg_replace pattern to do this? $bl = $_POST['bulletlist']; $pattern = '|^.+?display:none.+?$|mi'; $bl = preg_replace($pattern,'',$bl); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP script for detecting pattern sequences?
Can anyone tell me if there's a PHP library out there that will help me determine pattern sequences from a string? Example input: 032258064516129032258064516129032258064516129032258064516129 Sequence = 032258064516129 037037037037037037037037037037037037037037037037037037037037 Sequence = 037 I know regex can help you find a pattern when you know what the pattern is already, but this is different. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Best way to reinstate radio-button states from database?
I have a webpage which allows people to log in and make selections with radio buttons and hit SUBMIT and saves the data from those radio buttons to a mySQL database. However, I'm finding that I also need the ability to allow a user to log back in at a later date (or even on a different computer), and pull up that survey again, with each of the 50-something radio-buttons back in the positions in which they were last saved. Surely there's a best-case-method for doing this type of thing (saving large numbers of radio-button-group settings to mySQL and pulling them back again later). Any advice is greatly appreciated. Perhaps there's a jQuery-way to retrieve all the radio-button group settings as an array and save it and pull it back again? Or perhaps a PHP-specific method - - - I'm fine with either. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP/MySQL ISP recommendation that lets one edit ft_min_word_len variable?
Can anyone here recommend an ISP that will let me have a dedicated server (not shared), and also allow me to adjust the ft_min_word_len mySQL parameter? I was originally thinking Dreamhost PS, but I recently found out that they do not allow changes to mySQL environmental variables. I really need to adjust ft_min_word_len so that I can do rapid text searches on words less than 4 chars. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can PHP be used to snatch images cross-domain?
If I have a php script on my own server, can it be used to snatch a JPEG image off of another server on a different domain and upload it to my server? For example, could I provide an URL to an image on another server and a path on my own server in which to place it? I know in the world of Ajax, I could run into cross-domain security issues, but I'm wondering if I can get around that with PHP. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can PHP be used to snatch images cross-domain?
Brilliant! Now why do all these other scripts I've found make it look so hard?? http://wiki.dreamhost.com/index.php/CURL Take a look at the last script on that site. I suppose it's because of all the error-handling. That last downloader class looks promising, through I'm not sure how to pass an URL into it to get and save to a special directory on my server. I like your example better. On Tuesday, December 16, 2008, at 09:41PM, Robert Cummings rob...@interjinn.com wrote: On Tue, 2008-12-16 at 21:29 -0500, Rob Gould wrote: If I have a php script on my own server, can it be used to snatch a JPEG image off of another server on a different domain and upload it to my server? For example, could I provide an URL to an image on another server and a path on my own server in which to place it? I know in the world of Ajax, I could run into cross-domain security issues, but I'm wondering if I can get around that with PHP. Yes, this can be done quite easily. ?php $content = file_get_contents( 'http://www.foo.com/images/foo.png' ); file_put_contents( '/tmp/foo.png', $content ); ? You will need fopen wrappers enabled for this to work. Either way, there are other ways to skin the cat if fopen wrappers cannot be enabled. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Create unique non-autoincrement key for 700,000 records?
I have a mySQL database with 700,000 records in it, which are presently keyed with an auto-increment field. What I'd like to do is create another field with a field where each and every record number has a unique keyvalue. Example: su5e23vlskd for records 1, and 34fdfdsglkdj4 for record 2. All that matters is that it's unique, and isn't a number that can be guessed or an autoincrement number, where a hacker can just figure out the keyvalue by incrementing numbers. It doesn't matter to me if each keyvalue field is just numbers, or a number/letter combination - - - all that matters is that each keyvalue field is unique. Is there an automatic way that mySQL could do that, or would I need to write a php script to somehow go through each record and create this unique value? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Create unique non-autoincrement key for 700,000 records?
update mytable set hash_field = md5(AutoIdField + unix_timestamp()) I _think_ I understand that - - - - but what does the AutoldField variable mean? On Monday, December 15, 2008, at 09:37PM, Bastien Koert phps...@gmail.com wrote: On Mon, Dec 15, 2008 at 9:29 PM, Rob Gould gould...@mac.com wrote: I have a mySQL database with 700,000 records in it, which are presently keyed with an auto-increment field. What I'd like to do is create another field with a field where each and every record number has a unique keyvalue. Example: su5e23vlskd for records 1, and 34fdfdsglkdj4 for record 2. All that matters is that it's unique, and isn't a number that can be guessed or an autoincrement number, where a hacker can just figure out the keyvalue by incrementing numbers. It doesn't matter to me if each keyvalue field is just numbers, or a number/letter combination - - - all that matters is that each keyvalue field is unique. Is there an automatic way that mySQL could do that, or would I need to write a php script to somehow go through each record and create this unique value? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php update mytable set hash_field = md5(AutoIdField + unix_timestamp()) -- Bastien Cat, the other other white meat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Query-within-a-query with mySQL/PHP
This is somewhat complicated, so I'll try to give examples with real- world data. Basically, I'd like to know how I could take data like this, from mySQL: 2006 Liberty School Central Coast, California, Central Coast, USA Chardonnay 2006 Liberty School Paso Robles, California, Central Coast, USA Syrah 2006 Liberty School California, California, USA Cabernet Sauvignon 2005 Liberty School Paso Robles, California, Central Coast, USA Cabernet Sauvignon 2005 Liberty School Central Coast, California, Central Coast, USA Chardonnay 2005 Liberty School California, California, USA Cabernet Sauvignon 2005 Liberty School California, California, USA Zinfandel 2005 Liberty School California, California, USA Syrah 2005 Liberty School Paso Robles, California, Central Coast, USA Cabernet Sauvignon 2005 Liberty School Paso Robles, California, Central Coast, USA Syrah 2004 Liberty School California, California, , USA Cabernet Sauvignon 2004 Liberty School Paso Robles, California, Central Coast, USA Cabernet Sauvignon etc and create a query which would return the data like this: Liberty School Chardonnay (USA, California, Central Coast) 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1997, 1985 Liberty School Cabernet Sauvignon (USA, California) 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995, 1990, 1982, 1976 Liberty School Cabernet Sauvignon (USA, California, Central Coast, Paso Robles) 2005, 1993 Liberty School Cabernet Sauvignon (USA, California, Sonoma County) 2003, 1984 Basically I somehow need to do a GROUP BY producer, and yet somehow at the same time, find out all the matching vintages (years), that go along with that group and return them the same time the producer group is returned. Right now, my PHP/SQL query string is: $query = 'SELECT * FROM wine WHERE MATCH(producer, varietal, appellation, designation, region, vineyard, subregion, country, vintage) AGAINST ( ' . $combostring . ' IN BOOLEAN MODE ) ORDER BY ' . $orderby . ', producer ASC LIMIT 0,100'; This produced the first list you see at the top of this email. Any help is greatly appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP/mySQL question using ORDER BY with logic
Question about mySQL and PHP, when using the mySQL ORDER BY method... Basically I've got data coming from the database where a wine producer-name is a word like: Château Bahans Haut-Brion or La Chapelle de La Mission Haut-Brion or Le Clarence de Haut-Brion but I need to ORDER BY using a varient of the string: 1) If it begins with Château, don't include Chateau in the string to order by. 2) If it begins with La, don't order by La, unless the first word is Chateau, and then go ahead and order by La. Example sort: Notice how the producer as-in comes before the parenthesis, but the ORDER BY actually occurs after a re-ordering of the producer-string, using the above rules. Red: Château Bahans Haut-Brion (Bahans Haut-Brion, Château ) Red: La Chapelle de La Mission Haut-Brion (Chapelle de La Mission Haut-Brion, La ) Red: Le Clarence de Haut-Brion (Clarence de Haut-Brion, Le ) Red: Château Haut-Brion (Haut-Brion, Château ) Red: Château La Mission Haut-Brion (La Mission Haut-Brion, Château ) Red: Domaine de La Passion Haut Brion (La Passion Haut Brion, Domaine de ) Red: Château La Tour Haut-Brion (La Tour Haut-Brion, Château ) Red: Château Larrivet-Haut-Brion (Larrivet-Haut-Brion, Château ) Red: Château Les Carmes Haut-Brion (Les Carmes Haut-Brion, Château ) That logic between mySQL and PHP, I'm just not sure how to accomplish? I think it might involve a mySQL alias-technique but I could be wrong. Right now, my PHP call to generate the search is this: $query = 'SELECT * FROM wine WHERE MATCH(producer, varietal, appellation, designation, region, vineyard, subregion, country, vintage) AGAINST ( ' . $searchstring . ') ORDER BY producer LIMIT 0,100';
[PHP] Can Safari 3 be forced to cache a large jpeg with PHP headers?
I am creating a touch-screen kiosk application, using a full-screen version of Safari 3.1, and was wondering if there's a way I can force Safari to cache a large background image JPEG. What I'm finding is that Safari 3 will sometimes cache my large 1.1 MB background image (1680x1050), and display perfectly fine, but on occassion Safari 3 will think about the cache and Flash the screen white for a millisecond and then draw the screen. Firefox doesn't seem to have this problem, so unfortunately this is a Safari 3 only issue. I really only want to cache this ONE image - - - nothing else. Is that possible? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to determine which column matched
I'm trying to figure out a way that SQL can pass a flag to PHP to say which column matched during a query. Let's say for instance that I want to search for the word apple in both column producer, and column designation. I was hoping I could do something like this: Select producer, flag=1 from wine where producer like '%apple%' UNION Select designation, flag=2 from wine where designation like '%apple%' and then in each row that comes back, I could determine which column did that match by doing a PHP analysis of the flag value. However, this doesn't appear to be the right way to go about this (mySQL doesn't like these flag=1, flag=2 things. Can someone help steer me in the right direction? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Character set problems
mysql_query(SET NAMES utf8); This above line of code fixed my character problems. Yay! Was curious though - - - -is there a place somewhere in the cPanel or myPHPAdmin on my ISP (www.bluehost.com), where I can just have this happen automatically, or do I need to put this in my code everywhere I make a SQL call? On Thursday, April 03, 2008, at 11:14PM, Robert Cummings [EMAIL PROTECTED] wrote: On Thu, 2008-04-03 at 21:56 -0700, Rob Gould wrote: I'm having a hard time figuring out why my character sets and data look when when viewed in phpAdmin when browsing the table-columns, but then I go to show the data on my web-page with PHP, I get garbage-characters where I should be seeing apostrophs and special foreign-characters. I copied all the header-data from the phpAdmin pages: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en dir=ltr head meta http-equiv=Content-Type content=text/html; charset=utf-8 / where the characters all show up properly, and I've put this on my web-page. Here's what I know about my database, according to myphpadmin: From the phpAdmin settings page: MySQL charset: UTF-8 Unicode (utf8) MySQL connection collation: utf8_unicode_ci From the Structure tab for my table: Type: MyISAM Collation: utf8_unicode_ci So, based on the headers I'm using, and the myphpAdmin settings, is there something I'm missing? I guess I was assuming since the headers are set for utf-8, and the MySQL charset = UTF-8 Unicode (utf8), that everything would be compatible. Do you have this in your php.ini? default_charset = utf-8 Or if you want... the following in a .htaccess or virtual host config: php_value default_charset utf-8 You can even manually output it from within your PHP code: header( 'Content-Type: text/html; charset=utf-8' ); Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Character set problems
I'm having a hard time figuring out why my character sets and data look when when viewed in phpAdmin when browsing the table-columns, but then I go to show the data on my web-page with PHP, I get garbage-characters where I should be seeing apostrophs and special foreign-characters. I copied all the header-data from the phpAdmin pages: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en dir=ltr head meta http-equiv=Content-Type content=text/html; charset=utf-8 / where the characters all show up properly, and I've put this on my web-page. Here's what I know about my database, according to myphpadmin: From the phpAdmin settings page: MySQL charset: UTF-8 Unicode (utf8) MySQL connection collation: utf8_unicode_ci From the Structure tab for my table: Type: MyISAM Collation: utf8_unicode_ci So, based on the headers I'm using, and the myphpAdmin settings, is there something I'm missing? I guess I was assuming since the headers are set for utf-8, and the MySQL charset = UTF-8 Unicode (utf8), that everything would be compatible. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Copying specific fields from table to table
I've got 2 tables. One table which contains a series of barcodes assigned to product id #'s, and another table with JUST product id #'s. I need to somehow transfer all the barcodes from the first table into the second table, but only where the id #'s match. Can anyone tell me if this is something that can be done with just a SQL statement, or do I need to write a PHP script to loop through the records of both tables and do the copying/mapping? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP/mySQL dropping zeros after inserting number into record
I've got a PHP script that inserts 00012345678 into a record in a mySQL database (it's a barcode). Things work ok unless the number has preceding zeros, and then the zeros get cut off and all I get is 12345678. I have the mySQL database fieldtype set to bigint(14). If the maximum length a barcode can be is 14, is there a better fieldtype to use that will keep the zeros? (or some way for PHP to tell mySQL not to chop off the zeros?) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] question about database field-types and special characters
I've got a PHP application that pulls in data from a mySQL database. The data is a series of wine producers, and many of them have special foreign characters over the a's and o's. When I go and view the data from my database using myPHPAdmin, the characters look fine, but when I pull the data into my web-page the special characters get messed up. For whatever reason, when I first set up the database, someone told me to preserve special characters by setting my collation for the wine-producer field to latin1_swedish_ci. The data seems to be in there ok, so at least that works. Should I have used utf-8 instead? Can I set something in the doctype or header of my web-page to make it so that my website displays latin1_swedish_ci-based characters properly, or should I change my database field-type to be something different? My main fear is messing up the database (I'll back up first if I have to chance the field collation) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP/mySQL question about groups
Let's say I have a PHP-based wine application, and it's taking a set of mySQL data that looks like this: wineidname size 123 Silver Oak 750ML 123 Silver Oak 1.5L 123 Silver Oak 1.5L 456 Liberty School 750ML 456 Liberty School 750ML 456 Liberty School 750ML 456 Liberty School 1.5L If I do a: Select * from wine where name = 'Silver Oak' GROUP BY 'wineid' I'd get: Silver Oak However, what I'd REALLY like to return is: Silver Oak 750ML Silver Oak 1.5L I'd like the groupby to group by wineid, BUT ALSO separate the groups by 'size'. So there'd be a '750ML' group, and a '1.5L' group Can anyone tell me how I'd do that? I'm hoping I don't have to write a PHP script that loops through the results and separates things manually. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to take video embed codes and change all their widths/heights?
Can anytime give me some insights on how to write a PHP script that could accept any of the below strings below and edit the strings to change their width and height settings dynamically? For instance, if I want all embedded videos to have a width of 320, and a height of 240, using PHP's string manipulation commands, what's the best way to hone in on width=425 and change it to width=320? (In all cases in each string) stringtoedit='object width=425 height=355param name=movie value=http://www.youtube.com/v/B1O2jcfOylUrel=1;/paramparam name=wmode value=transparent/paramembed src=http://www.youtube.com/v/B1O2jcfOylUrel=1 type=application/x-shockwave-flash wmode=transparent width=425 height=355/embed/object'; stringtoedit='object width=464 height=388 classid=clsid:d27cdb6e- ae6d-11cf-96b8-44455354param name=movie value=http://www2.funnyordie.com/public/flash/fodplayer.swf /param name=flashvars value=key=5468 /param name=allowfullscreen value=true /embed width=464 height=388 flashvars=key=5468 allowfullscreen=true quality=high src=http://www2.funnyordie.com/public/flash/fodplayer.swf type=application/x-shockwave-flash/embed/objectnoscripta href=http://www.funnyordie.com/videos/5468;Cars/a on a href=http://www.funnyordie.com FunnyOrDie.com/a/noscript'; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to handle rows of checkboxes upon form submit?
Let's say I have a PHP script which lists a series of objects for sale at a yard sale, each with a checkbox to the left of the name of the item. If I wanted to have a submit button, and run through the list of items that were checked and act on them, how would I do that? To gain some knowledge, I went into phpMyAdmin and looked at their checkboxes, and I see their code: input type=checkbox id=checkbox_row_6 value=apples name=selected_fld[] input type=checkbox id=checkbox_row_7 value=oranges name=selected_fld[] input type=checkbox id=checkbox_row_8 value=bananas name=selected_fld[] So it looks like they do something with name=select_fld[], which must be part of the secret to making this work. Any advice is greatly appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Way to XML-parse data with f n=name /f tags?
Sorry if this is a duplicate post, I'm new to the listserve and I'm not sure my first message made it through I've been trying to retro-fit sample code found at : http:// www.sitepoint.com/article/php-xml-parsing-rss-1-0 to parse XML coming from a server. I'm sooo close to getting this working, but I've hit a roadblock and could use some help. To see the data I'm needing to parse, go here: http:// www.librarytools.com/events/sampledata.txt. This is just sample data from the host, as it's behind a firewall. The problem I'm having is that the XML data that comes back from the host doesn't just have eventname /eventname tags. It has f n=eventnamedatahere/f tags, and I don't know how to get the XML parser to read the values using that format. (And I don't have control over the host) As a first step, I just want to retrieve the eventname, venuename, and venuecity data from within the result tags at the bottom of the data. I'm really hoping this is possible with PHP - - - can someone please steer me in the right direction and tell my what I should change in the below script? The $tag value is not getting a value string, due to the XML-data Here's my present script: ?php $insideitem = false; $tag = ; $eventname = ; $venuename = ; $venuecity = ; function startElement($parser, $name, $attrs) { global $insideitem, $tag, $eventname, $venuename, $venuecity; if ($insideitem) { $tag = $name; } elseif ($name == RESULT) { echo found result; $insideitem = true; } } function endElement($parser, $name) { global $insideitem, $tag, $eventname, $venuename, $venuecity; if ($name == RESULT) { echo result in endElement; printf(dtba href='%s'%s/a/b/dt, trim($venuecity),htmlspecialchars(trim($eventname))); printf(dd%s/dd,htmlspecialchars(trim($venuename))); $eventname = ; $venuename = ; $venuecity = ; $insideitem = false; } } function characterData($parser, $data) { global $insideitem, $tag, $eventname, $venuename, $venuecity; if ($insideitem) { echo $tag; switch ($tag) { case EVENTNAME: $eventname .= $data; echo got an event!; break; case VENUENAME: $venuename .= $data; break; case VENUECITY: $venuecity .= $data; break; } } } $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, startElement, endElement); xml_set_character_data_handler($xml_parser, characterData); $fp = fopen(http://www.librarytools.com/events/sampledata.txt,r;) or die(Error reading RSS data.); echo $fp; while ($data = fread($fp, 4096)) xml_parse($xml_parser, $data, feof($fp)) or die(sprintf(XML error: %s at line %d, xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); fclose($fp); xml_parser_free($xml_parser); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $35 to the first person who can do this XML-parsing PHP script
Ok, well after fiddling around with PHP samples from the web for a few hours, I'm shot. But I have a project due soon that relies on this so I'm willing to pay someone: I'll send $35 to someone via paypal who can create a PHP script that will do the following: 1) Read XML data from an URL (www.librarytools.com/events/ sampledata.txt) 2) Loop through all XML results and print to the screen the eventname and eventnextoccurrencedate (Just the date) values I'll probably kick myself once I see how easy it is, but I'm willing to pay to see it working. Feel free to email me off-list. - Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: $35 to the first person who can do this XML-parsing PHP script
Ok, well at least I'm honing in on the problems now. I appears that my ISP is only running php 4.4.4. So back in the PHP 4-days, what was the preferred method of doing such things? - Rob On Mar 8, 2007, at 3:13 PM, Ben Ramsey wrote: On 3/8/07 2:59 PM, Rob Gould wrote: 1) Read XML data from an URL (www.librarytools.com/events/ sampledata.txt) 2) Loop through all XML results and print to the screen the eventname and eventnextoccurrencedate (Just the date) values I'll probably kick myself once I see how easy it is, but I'm willing to pay to see it working. Feel free to email me off-list. If you're using PHP 5, take a look at SimpleXML. This is extremely easy to do. http://www.php.net/simplexml Take a look at Example 2134 on that page to get you started, and see http://www.php.net/simplexml_load_file to load XML from a URL. Do I get the $35 anyway for the consultation? ;-) -- Ben Ramsey http://benramsey.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $35 to the first person who can do this XML-parsing PHP script
I have to say this is the most helpful listserve I've ever joined! Such friendly people and such good information. Well, the main thing I learned is - - - PHP 5 rocks, and PHP 4 semi- rocks, but not enough to make XML-parsing enjoyable. So, what I did was I installed MAMP on my Mac OS X box, and got the latest PHP 5 running, and then used the Simple XML routines. A - - - _much_ better. PHP XML-parsing with SimpleXML is definitely the way to go. It does in 10 lines of code what PHP4 took 50 lines of code to do. Next I just have to switch ISP's so that I can use PHP5 in the outside world. - Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php