Re: [PHP] Graphs
What kind of do u wanna have? Am Sonntag, den 22.01.2006, 10:46 +0200 schrieb Weber Sites LTD: > What is the best (Free) way to create good looking graphs with PHP? > > Sincerely > > berber > > Visit the Weber Sites Today, > To see where PHP might take you tomorrow. > PHP code examples : http://www.weberdev.com > PHP & MySQL Forums : http://www.weberforums.com > Learn PHP & MySQL Playing Trivia : http://www.webertrivia.com > PHP Web Logs : http://www.weberblogs.com > Web Development Index http://www.weberindex.com > Web Templates http://www.webertemplates.com > Search for PHP Code from your browser http://toolbar.weberdev.com > Free Uptime Monitor : http://uptime.weberdev.com > PHP content for your site : http://content.weber-sites.com >
Re: [PHP] Str to Int
Am Freitag, den 20.01.2006, 18:28 -0500 schrieb comex: > > if ($cardID=''||is_int($cardID)) > > Two problems with that statement: > First of all, this statement _sets_ cardID to '', and then (I think) > returns a false value since '' doesn't evaluate to true. You probably > wanted ==. hOOps that's right, shit, haven't seen that..hm okay, it works fine now, thanks again! > Second of all, now that $cardID is '', it certainly isn't an int. It > isn't an int, and it wouldn't be an int if you fixed that statement > because is_int only tests if it is, actually, an integer. > $HTTP_GET_VARS['cardID'] could be '123', but it can't be 123 and so > that will be false. From the PHP manual: > > Note: To test if a variable is a number or a numeric string (such > as form input, which is always a string), you must use is_numeric(). > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Str to Int
Am Freitag, den 20.01.2006, 16:08 -0700 schrieb Gerry Danen: > You probably want to do an is_int() first... > > After that, you know it's an int and treat it that way. Why do you > need to typecast it? > > BTW, change $cardID = $HTTP_GET_VARS[cardID]; to $cardID = > $_GET['cardID']; for PHP5 compatibility... ;-) > > Gerry Hey, it seems to be recognied by is_int() as integer. I have following code: [php] if ($HTTP_GET_VARS) // if some GET variables were passed on,... { switch ($HTTP_GET_VARS['action'])// recognize the get-var 'action' { case reserve: // it says, 'reserve PINs' $cardID = $HTTP_GET_VARS['cardID']; // get cardID which was passed by GET as well if ($cardID=''||is_int($cardID)) // unless, { $cardID = intval($cardID.trim()); echo "ERROR, cardID='' or cardID is no integer!\n"; //print Error exit(0); //and leave } echo "reserve\n"; // Variables were okay, so go ahead with the reserving / [reserve SKU] / $inputdata = ''.$n.' '; / [/reserve SKU] ***/ break; [/php] it doesn't work that way but if I replace ['.intval(trim($cardID)).'] with [180] (everything between the []-brakets) it seems to work and cardID was passed with the URL: http://localhost/ewi.php?action=reserve&cardID=180 So what the hell is going wrong? Thank you! chEErs roN > > On 1/20/06, Ron Eggler (Paykiosks) <[EMAIL PROTECTED]> wrote: > Hi, > > I need to do a type cast from string to int in folllowing > code: > [php] > > [/php] > I need $cardID have converted to int. I thought it should work > that way > but it does not! > But it's working if I'm putting > [php] > > [/php] > in there. I got card ID as a var that is passed as get like: > [php] > $cardID = $HTTP_GET_VARS[cardID]; > [/php] > > Can anyone help me in that issue? Thank you! > > __ > > Ron Eggler > Intern > 866-999-4179 > www.paykiosks.net > > > > > > > -- > Gerry > http://portal.danen.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Str to Int
Hi, I need to do a type cast from string to int in folllowing code: [php] [/php] I need $cardID have converted to int. I thought it should work that way but it does not! But it's working if I'm putting [php] [/php] in there. I got card ID as a var that is passed as get like: [php] $cardID = $HTTP_GET_VARS[cardID]; [/php] Can anyone help me in that issue? Thank you! __ Ron Eggler Intern 866-999-4179 www.paykiosks.net
Re: [PHP] parse string
Am Donnerstag, den 19.01.2006, 16:42 -0600 schrieb Richard Lynch: > G. I forgot PHP Object printing was so primitive, even under > var_dump. :-( > > function walkout($object, $indent = 0){ > if (is_object($object) or is_array($object)){ > foreach($object as $k => $v){ > echo str_repeat(' ', $indent), $k, ' => '; > walkout($v, $indent + 1); > } > } > else echo $v, "\n"; > } > > echo ""; > walkout($xml); > echo ""; yes, and now? it just prints every subject like: SKUlisting => globalInfo => carrierInfo => carrierInfo => carrierInfo => carrierInfo => carrierInfo => carrierInfo => carrierInfo => carrierInfo => carrierInfo => carrierInfo => carrierInfo => carrierInfo => carrierInfo => carrierInfo => carrierInfo => cardSKU => card => cinfo => changed the function a bit [just inserted ] I have no idea yet, how I'm gonna reach my goal... :( __ Ron Eggler Intern 866-999-4179 www.paykiosks.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parse string
[snipped everything] Okay, If I'm gonna dump $xml i get a huge output put can't fin category in there: [Output] object(SimpleXMLElement)#1 (1) { ["SKUlisting"]=> object(SimpleXMLElement)#3 (3) { ["globalInfo"]=> object(SimpleXMLElement)#4 (0) { } ["carrierInfo"]=> array(15) { [0]=> object(SimpleXMLElement)#2 (0) { } [1]=> object(SimpleXMLElement)#6 (0) { } [2]=> object(SimpleXMLElement)#7 (0) { } [3]=> object(SimpleXMLElement)#8 (0) { } [4]=> object(SimpleXMLElement)#9 (0) { } [5]=> object(SimpleXMLElement)#10 (0) { } [6]=> object(SimpleXMLElement)#11 (0) { } [7]=> object(SimpleXMLElement)#12 (0) { } [8]=> object(SimpleXMLElement)#13 (0) { } [9]=> object(SimpleXMLElement)#14 (0) { } [10]=> object(SimpleXMLElement)#15 (0) { } [11]=> object(SimpleXMLElement)#16 (0) { } [12]=> object(SimpleXMLElement)#17 (0) { } [13]=> object(SimpleXMLElement)#18 (0) { } [14]=> object(SimpleXMLElement)#19 (0) { } } ["cardSKU"]=> array(45) { [0]=> object(SimpleXMLElement)#20 (3) { ["card"]=> object(SimpleXMLElement)#65 (1) { ["cinfo"]=> object(SimpleXMLElement)#67 (0) { } } ["terms"]=> string(65) "Refer to the Reconex brochure for complete terms and conditions. " ["pinfo"]=> object(SimpleXMLElement)#66 (0) { } } [1]=> object(SimpleXMLElement)#21 (3) { ["card"]=> object(SimpleXMLElement)#68 (1) { ["cinfo"]=> object(SimpleXMLElement)#70 (0) { } } ["terms"]=> string(65) "Refer to the Reconex brochure for complete terms and conditions. " ["pinfo"]=> object(SimpleXMLElement)#69 (0) { } } [2]=> object(SimpleXMLElement)#22 (3) { ["card"]=> object(SimpleXMLElement)#71 (1) { ["cinfo"]=> object(SimpleXMLElement)#73 (0) { } } ["terms"]=> string(65) "Refer to the Reconex brochure for complete terms and conditions. " ["pinfo"]=> object(SimpleXMLElement)#72 (0) { } } [3]=> object(SimpleXMLElement)#23 (3) { ["card"]=> object(SimpleXMLElement)#74 (1) { ["cinfo"]=> object(SimpleXMLElement)#76 (0) { } } ["terms"]=> string(65) "Refer to the Reconex brochure for complete terms and conditions. " ["pinfo"]=> object(SimpleXMLElement)#75 (0) { } } [4]=> object(SimpleXMLElement)#24 (3) { ["skuswipe"]=> object(SimpleXMLElement)#77 (0) { } ["card"]=> object(SimpleXMLElement)#78 (1) { ["cinfo"]=> object(SimpleXMLElement)#80 (0) { } } ["terms"]=> object(SimpleXMLElement)#79 (0) { } } [5]=> object(SimpleXMLElement)#25 (3) { ["skuswipe"]=> object(SimpleXMLElement)#81 (0) { } ["card"]=> object(SimpleXMLElement)#82 (1) { ["cinfo"]=> object(SimpleXMLElement)#84 (0) { } } ["terms"]=> object(SimpleXMLElement)#83 (0) { } } [6]=> object(SimpleXMLElement)#26 (3) { ["skuswipe"]=> object(SimpleXMLElement)#85 (0) { } ["card"]=> object(SimpleXMLElement)#86 (1) { ["cinfo"]=> object(SimpleXMLElement)#88 (0) { } } ["terms"]=> object(SimpleXMLElement)#87 (0) { } } [7]=> object(SimpleXMLElement)#27 (4) { ["skuswipe"]=> object(SimpleXMLElement)#89 (0) { } ["loadValueInfo"]=> object(SimpleXMLElement)#90 (0) { } ["card"]=> object(SimpleXMLElement)#91 (1) { ["cinfo"]=> object(SimpleXMLElement)#93 (0) { } } ["terms"]=> object(SimpleXMLElement)#92 (0) { } } [8]=> object(SimpleXMLElement)#28 (4) { ["skuswipe"]=> object(SimpleXMLElement)#94 (0) { } ["loadValueInfo"]=> object(SimpleXMLElement)#95 (0) { } ["card"]=> object(SimpleXMLElement)#96 (1) { ["cinfo"]=> object(SimpleXMLElement)#98 (0) { } } ["terms"]=> object(SimpleXMLElement)#97 (0) { } } [9]=> object(SimpleXMLElement)#29 (4) { ["skuswipe"]=> object(SimpleXMLElement)#99 (0) { } ["loadValueInfo"]=> object(SimpleXMLElement)#100 (0) { } ["card"]=> object(SimpleXMLElement)#1
Re: [PHP] parse string
Am Donnerstag, den 19.01.2006, 13:51 -0600 schrieb Richard Lynch: > On Thu, January 19, 2006 12:08 pm, Ron Eggler (Paykiosks) wrote: > > > distributor="EWI" > > discontinued="false" cardtype="PIN" transactionType="PURC"> > . > . > . > > > > [/xml] > > > > and I wanna read information out of it by: > > [php] > > $xml = simplexml_load_string($data); > > /* a few other things like parsing xml that works fine */ > > foreach ($xml->cardSKU as $cardSKU) > > { > > array_push($category,(string)$cardSKU['category']); > > } > > [/php] > > but it seems not to work, the array $category stays empty, why that? > > It's pretty much the same problem you posted yesterday... > > category is going to be the $key of the array, not the value. > > echo "xml->cardSKU:\n"; > var_dump($xml->cardSKU); > echo "\n"; > foreach($xml->cardSKU as $key => $cardSKU){ > echo "key: $key\n" > var_dump($cardSKU); > echo "\n"; > } > > When you don't get the data you expect, use var_dump() on the data > BEFORE that to see where the bits you want exist -- You'll usually > find that they array/key/value/object structure has what you want, > just in different places than you were looking. > Sorry, I can' really get it :( I inserted your code and got this: [html] xml->cardSKU: object(SimpleXMLElement)#3 (0) { } [/html] shouldn't there be listed all elements of 'category'? Thanks again and sorry if I'm driving you crazy by that but it's the really first time I'm doing something like that... __ Ron Eggler Intern 866-999-4179 www.paykiosks.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parse string
yup, I finally got it parsed by simple XML, thank you! but I got a problem, my xml-string returns many parts like this one: [xml] https://www.pinsprepaid.com/image.aspx?name=c38-reconex_logo.gif"; upc="870368000420"> Refer to the Reconex brochure for complete terms and conditions. [/xml] and I wanna read information out of it by: [php] $xml = simplexml_load_string($data); /* a few other things like parsing xml that works fine */ foreach ($xml->cardSKU as $cardSKU) { array_push($category,(string)$cardSKU['category']); } [/php] but it seems not to work, the array $category stays empty, why that? Thank you! -- chEErs roN Am Mittwoch, den 18.01.2006, 16:40 -0600 schrieb Richard Lynch: > Simple XML *should* give you all the info somewhere in its data > structures. > > If not, there are at least 2 or 3 other XML parsers that have been > built s extensions to PHP over the years. > > Plus there is at least one XML parser in PEAR, and probably one or > more in PECL. > > A quick search on http://php.net will find them. > > If all else fails, and you're really really stuck with no XML parsers > due to brain-dead web-hosting, it should take you about an hour to > hack a script to use http://php.net/explode and/or > http://php.net/preg_match_all to get the info you want, *IF* the XML > is predictable. > > It is NOT recommended that you do this, but here is a start if you > really have no way to get a real XML parser on-board: > > $string = '[insert your XML here]'; > preg_match_all('/<(a-z)+\\s*(([a-z]+)="([^"]*)"\\s*)*\\s*\\/>/isU', > $string, $matches); > var_dump($matches); > > You may want to find and download "The Regex Coach" program to help > you learn/understand Regular Expressions. > > On Wed, January 18, 2006 12:12 pm, Ron Eggler (Paykiosks) wrote: > > Hi, > > > > I need to parse a String like pasted below for all information > > (values) > > those are included like 'var=value'. How can I do that? Are there any > > XML-parsing functions available those'd fit for that job? I've ust > > found > > that one (http://ca.php.net/simplexml) but it seems like i could use > > it > > only for exctracting the 'terms' cause they're in the format that > > simplexml > > expects. > > Thank you for every help! > > > > [String] > > > > > > > > > icon="https://www.pinsprepaid.com/image.aspx?name=c38-reconex_logo.gif"; > > /> > > > icon="https://www.pinsprepaid.com/image.aspx?name="; /> > > > icon="https://www.pinsprepaid.com/image.aspx?name="; /> > > > icon="https://www.pinsprepaid.com/image.aspx?name=PlayPhone-200x100.gif"; > > /> > > > icon="https://www.pinsprepaid.com/image.aspx?name=PayGo_200_100.gif"; > > /> > > > icon="https://www.pinsprepaid.com/image.aspx?name="; /> > > > icon="https://www.pinsprepaid.com/image.aspx?name="; /> > > > icon="https://www.pinsprepaid.com/image.aspx?name="; /> > > > icon="https://www.pinsprepaid.com/image.aspx?name=c59-BoostMobile.gif"; > > /> > > > icon="https://www.pinsprepaid.com/image.aspx?name=cing-blue.gif"; /> > > > icon="https://www.pinsprepaid.com/image.aspx?name=pageplus.gif"; /> > > > icon="https://www.pinsprepaid.com/image.aspx?name=c29-t-mobile_ticketlogo.gif"; > > /> > > > icon="https://www.pinsprepaid.com/image.aspx?name=unefon_logo.gif"; /> > > > icon="https://www.pinsprepaid.com/image.aspx?name=verizon.gif"; /> > > > icon="https://www.pinsprepaid.com/image.aspx?name=Virgin+Mobile > > +200x100.gif" /> > > > distributor="EWI" > > discontinued="false" cardtype="PIN" transactionType="PURC"> > >> region="Optional Services (test)" amount="5" wholesalePrice="4.5" > > icon="https://www.pinsprepaid.com/image.aspx?name=c38-reconex_logo.gif"; > > upc="870368000420"> > > > roamingRate="" > > numberOfMin=""/> > > > > > > Refer to the Reconex brochure for complete terms and conditions. > > > > > > > > > distributor="EWI" > > discontinued="false" cardtype="PIN" transactionType="PURC"> > >> region="Optional Services (test)" a
[PHP] parse string
Hi, I need to parse a String like pasted below for all information (values) those are included like 'var=value'. How can I do that? Are there any XML-parsing functions available those'd fit for that job? I've ust found that one (http://ca.php.net/simplexml) but it seems like i could use it only for exctracting the 'terms' cause they're in the format that simplexml expects. Thank you for every help! [String] https://www.pinsprepaid.com/image.aspx?name=c38-reconex_logo.gif"; /> https://www.pinsprepaid.com/image.aspx?name="; /> https://www.pinsprepaid.com/image.aspx?name="; /> https://www.pinsprepaid.com/image.aspx?name=PlayPhone-200x100.gif"; /> https://www.pinsprepaid.com/image.aspx?name=PayGo_200_100.gif"; /> https://www.pinsprepaid.com/image.aspx?name="; /> https://www.pinsprepaid.com/image.aspx?name="; /> https://www.pinsprepaid.com/image.aspx?name="; /> https://www.pinsprepaid.com/image.aspx?name=c59-BoostMobile.gif"; /> https://www.pinsprepaid.com/image.aspx?name=cing-blue.gif"; /> https://www.pinsprepaid.com/image.aspx?name=pageplus.gif"; /> https://www.pinsprepaid.com/image.aspx?name=c29-t-mobile_ticketlogo.gif"; /> https://www.pinsprepaid.com/image.aspx?name=unefon_logo.gif"; /> https://www.pinsprepaid.com/image.aspx?name=verizon.gif"; /> https://www.pinsprepaid.com/image.aspx?name=Virgin+Mobile +200x100.gif" /> https://www.pinsprepaid.com/image.aspx?name=c38-reconex_logo.gif"; upc="870368000420"> Refer to the Reconex brochure for complete terms and conditions. https://www.pinsprepaid.com/image.aspx?name=c38-reconex_logo.gif"; upc="870368000437"> Refer to the Reconex brochure for complete terms and conditions. https://www.pinsprepaid.com/image.aspx?name=c38-reconex_logo.gif"; upc="870368000413"> Refer to the Reconex brochure for complete terms and conditions. https://www.pinsprepaid.com/image.aspx?name=c38-reconex_logo.gif"; upc="870368000406"> Refer to the Reconex brochure for complete terms and conditions. [/String]
[PHP] XML-Request
Hi, I gotta send an XML request to a server. In the doc it's defined as follows: [request] [/request] and I tried to realize it that way: [Code] '.$n.' '; $x = curl_init("https://xml.pinsprepaid.com/xml/xmlPinXpress.asp";); curl_setopt($x, CURLOPT_HTTPHEADER, array('Content-Type: text/xml')); curl_setopt($x, CURLOPT_HEADER, 0); curl_setopt($x, CURLOPT_POST, 1); curl_setopt($x, CURLOPT_POSTFIELDS, $inputdata); curl_setopt($x, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($x, CURLOPT_REFERER, "http://localhost/test.php";); curl_setopt($x, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($x); curl_close($x); echo $data; ?> [Code] but I only got the Answer: "invalid xml" Why, what's going wrong? Thank you for your help! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php