PHP - Parsing A Url And Unexpected T_encapsed_and_whitespace
Can anybody help me to echo a url?
Id like to have Code: [Select] http://maps.google.com/maps/api/staticmap?zoom=15&size=400x400&markers=color:blue|label:EXAMPLE|SG1+4PP&sensor=false but to have the postcode as a variable which has been fetched from mysql Code: [Select] <!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"> <head> <?php include($_SERVER['DOCUMENT_ROOT'].'/include/db.php'); ?> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> <!-- --> </style> <link href="header.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="banner"> <div id="bannerleft"></div> <div id="logo"></div> <div id="bannerright"><div id="navbar" title=""> <div id="b1"><p class="centre"><a href="index.html">Directory</a></p></div> <div id="b2"><p class="centre"><a href="business.html">Add Your Business</a></p></div> <div id="b3"><p class="centre"><a href="contact.html">Contact Us</a></p></div> </div><!-- end of navbar--> </div><!--end of bannerright--> </div><!-- end of banner--> <div id="listhold"> <?php $subtype = $_GET['subtype']; echo "<h1>$subtype</h1>"; $result = mysql_query("SELECT name, phone, email, WebAddress, postcode FROM business WHERE subtype ='$subtype' AND confirmed ='Yes' ORDER BY name"); echo mysql_error(); while($row = mysql_fetch_array($result)) { echo $row['name'] . "<br>"; echo $row ['phone'] . "<br>"; echo $row['email'] . "<br>"; echo $row['WebAddress'] . "<br>"; echo $row['postcode'] . "<br>" . "<br>"; echo "<a href='http://maps.google.com/maps/api/staticmap?zoom=15&size=400x400&markers=color:blue|label:EXAMPLE|.str_replace(' ','+',$row['postcode'])&sensor=false'>"; } ?> </div> </body> </html> The above returns an error; Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING Similar TutorialsI haven't used PHP in a while. I'm getting "unexpected T_ENCAPSED_AND_WHITESPACE" on the second line of this: Code: [Select] if(isset($_GET['name'], $_GET['organization'], $_GET['email'], $_GET['message'])){ mail('memzenator@gmail.com', 'maybearobot: '.$_GET['organization'], "Name: $_GET['name'] /n/n Return Email: $_GET['email'] /n/n $_GET['message']"); } I'm getting: Quote unexpected T_ENCAPSED_AND_WHITESPACE Bull shit! Where?! echo "<B>Brand:</B> $row['brand']"; Easy one i hope... Heres my array: echo "<TABLE CELLPADDING=0 CELLSPACING=0 WIDTH=100% BORDER=0>"; echo "<TR />"; echo "<TD WIDTH=30% VALIGN=TOP />"; echo " <IMG SRC=$row['CarPrice]/> "; <----- THIS IS LINE 66 THAT THE ERROR APPEARS ON!! echo "<br />"; echo "</TD>"; echo "<TD WIDTH=10 VALIGN=TOP />"; echo " "; echo "</TD>"; echo "<TD />"; echo "<font size=3 face=arial /><B >"; echo $row['CarPrice']; echo "</B><font size=2 face=arial />"; echo "<br />"; echo $row['CarTitle']; echo "<br />"; Have i encased the $row['photo'] properly? I can't seem to figure this error out... Any help would be appreciated!! echo stripslashes($post['message']) . " --- stripslashes($post['username'])<br>\n" . " on stripslashes($post['time']) ."\n<hr width=90%>\n"; Basically, what I want it to say is: 'message' --- 'username' on 'time' With, of course, 'message', 'username', and 'time' filled in with the info from the database. Hi Guys I have got a page generating the following error Error:Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/sites/trade-bidz.co.uk/public_html/functions/reg_functions.php on line 3 The offending code is below (I have removed some of the URL due to security. Code: [Select] <?php function getVehData(){ $file="https://www.cdlvis.com/lookup/getxml?username=***********&mode=test&key=*********&vrm=$_POST['veh_reg']"; $dom=new DOMdocument(); $dom->load($file); $xml=simplexml_import_dom($dom); echo('<tr><td>Make<td></td></tr> <tr><td>Model<td></td></tr> <tr><td>Make<td></td></tr> <tr><td>Date of Manufacture<td></td></tr> <tr><td>First Registered<td></td></tr> <tr><td>Colour<td></td></tr> <tr><td>Body<td></td></tr> <tr><td>No. of Doors<td></td></tr> <tr><td>Engine Size (cc)<td></td></tr> <tr><td>Fuel Type<td></td></tr> <tr><td>Gearbox Type<td></td></tr> <tr><td>Previous Owners<td></td></tr> <tr><td>BHP<td></td></tr> <tr><td>Emissions<td></td></tr> </table> '); } ?> Hi all, Does anybody can help me with this error...? I am trying create a simple form which insert data into mysql table called 'sample' Here is my code... Code: [Select] <?php $connection = mysql_connect("localhost","root", "123"); if(!$connection) { die("db connection error" .mysql_error()); } $db_select = mysql_select_db("project", $connection); if(!$db_select) { die("db select error" .mysql_error()); } $sql = "INSERT INTO sample (id,firstname,lastname,bio,gender) VALUES ('$_POST['ID_']','$_POST['firstname']','$_POST['lastname']','$_POST['bio']','$_POST['gender']')"; if(!$sql) { die('Error: ' . mysql_error()); } echo "1 record added"; ?> And every time I am getting this annoying error Quote Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\wamp\www\project\process.php on line 19 and Line 19 is Code: [Select] ('$_POST['ID_']','$_POST['firstname']','$_POST['lastname']','$_POST['bio']','$_POST['gender']')"; Thanks in advance..! :-) I Can't find the problem. The code:
mysql_query("insert into games(week, fight, league_id)values($_REQUEST['week'],'$_REQUEST[home_team]-$_REQUEST[guest_team]',$_REQUEST['home_league'])", $Link);The error message: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING $listhtml .= "<a href=\"$latest['cat_title']/$latest[haha]\" title=\"Details for $latest[haha]\">$latest[haha] ($date)</a>\n"; so this is the line it says this error is originating from. I dont know any php..if anyoen can help that would be great. Thanks in advance Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in F:\san\WEB\as-\menu.php on line 64 line 64 is : $kategoriler .= "<li><a href='index.php?MX=urundetay&kategori_id'=.$row_uruns['kategori_id']'>".$veri['baslik']."</a>\n"; where is wrong Hey Guys! I've been looking through my script to see what the problem could be, I've got a variable setup to generate a web page, I have no idea what could be the problem, I keep receiving the error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in home/path/etc on line 8 But I don't see any miss-matching Quotations etc... I don't know what the problem could be, maybe you could help me? Code: 1 <?php 2 $content = "<?php 3 $productid = 1; 4 $sql = 'SELECT * FROM table1 WHERE productid =' . $productid . ''; 5 if ($result = mysql_query($sql)) { 6 if (mysql_num_rows($result)) { 7 $row = mysql_fetch_assoc($result); 8 $leader = $row['leader']; 9 } 10 } 11 ?>"; 12 echo($content); 13 ?> Thanks! Regards Matthew Hello everyone! I have been trying to figure out how I can go about this, and failing. I have a text file that lists records simply: ex: 99. I got in my friends "car", what a piece of crap... ex:100. It only goes 25mph. I need to parse it so that it uses the number to store in the table, or just remove everything and store the text to the end, using an auto increment for the line number(some span more than one line). The numbers cannot be used as a key either. The number of spaces after the number and period also varies, from 1-4. The text also contains other special characters such as quotes, numbers, commas, periods. Anyone have any ideas? I've been reading parsing xml with php forums all day and still can't seem to figure out how to start with this one. there is a node he http://xml.heroesofnewerth.com/xml_requester.php?f=match_stats&opt=mid&mid[]=30428528 called match_stats. All i need help with is how to get those 10 elements inside match_stats and how to grab the stat name= nickname from each element. I'm just looking for somewhere to start and I'm sure I can figure out the rest. Thanks Hello, I have an xml file below with multiple namespaces called "date". I want to know how to echo out each date that is associated with that "item" if that makes sense. Thanks Code: [Select] <?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/"> <channel> <item> <title>My Title</title> <dc:date>2009-02-12</dc:date> <dc:date>2010-09-01</dc:date> </item> </channel> </rss> Basically I'm reading a local xml file, extracting data, and passing array over to a MySql function. Also, when each record is extracted I need to know the full parent-child category it was listed under. for example: <root> <node value="first"/> <node value="second"/> <header label="Numbers"> <header label="Roman numerals"> <node value="I"/> <node value="XV"/> </header> <node value="1"/> <node value="10"/> </header> </root> I'm trying to go through a document and replace all the UBB tags with different values. I can preg match the tags, but I don't quit remember how to do the replacement. Tags are like: ect. Anyone have a basic example I can go from? I know I've done it before, just can't think tonight. Ok there is more than one <land> on that xml. I need to parse out the name and cost and id of each land ... how can I do this? here is some of the xml Notice that there is more than one <land> entry, I need to parse out each land and have it assigned to a certain variable . thanks Code: [Select] <outer> − <xml> − <undeveloped_lands> − <land> <id>200</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fpawn%5Fshop%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Pawn%20Shop%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%24200%2C000%3C%2Fspan%3E%3Cbr%3E </details> <num_owned>0</num_owned> <cost>1000000000</cost> <is_racket>true</is_racket> <favor_points>0</favor_points> <purchase_limit>5</purchase_limit> <name>Pawn%20Shop</name> <income>$200,000</income> − <enhancements> − <enhancement> <value>1</value> − <suffix> % chance of a spirited defense (1/2x damage) when attacked </suffix> <prefix>+</prefix> <type>ATTACK_CRITICAL_DEFENSE_PERCENT</type> </enhancement> </enhancements> </land> − <land> <id>0</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fbig%2Fempty%5Flot%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Vacant%20Lot%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%24100%3C%2Fspan%3E%3Cbr%3E </details> <num_owned>0</num_owned> <is_racket/> <cost>4500</cost> <favor_points>0</favor_points> <name>Vacant%20Lot</name> <income>$100</income> </land> − <land> <id>1</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fbig%2Fempty%5Fstorefront%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Empty%20Storefront%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%24300%3C%2Fspan%3E%3Cbr%3E </details> <num_owned>0</num_owned> <is_racket/> <cost>45000</cost> <favor_points>0</favor_points> <name>Empty%20Storefront</name> <income>$300</income> </land> − <land> <id>201</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fscrap%5Fyard%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Scrap%20Yard%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%24200%2C000%3C%2Fspan%3E%3Cbr%3E </details> <num_owned>0</num_owned> <cost>1000000000</cost> <is_racket>true</is_racket> <favor_points>0</favor_points> <purchase_limit>5</purchase_limit> <name>Scrap%20Yard</name> <income>$200,000</income> − <enhancements> − <enhancement> <value>1</value> <suffix>% chance of critical hits in fights</suffix> <prefix>+</prefix> <type>ATTACK_CRITICAL_HIT_PERCENT</type> </enhancement> </enhancements> </land> − <land> <id>2</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fbig%2Fplaza%5Fv2%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Plaza%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%242%2C000%3C%2Fspan%3E%3Cbr%3E </details> <num_owned>0</num_owned> <is_racket/> <cost>900000</cost> <favor_points>0</favor_points> <name>Plaza</name> <income>$2,000</income> </land> − <land> <id>9</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fbig%2Fbeach%5Flot%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Seaside%20Lot%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%248%2C000%3C%2Fspan%3E%3Cbr%3E </details> <num_owned>0</num_owned> <is_racket/> <cost>3500000</cost> <favor_points>0</favor_points> <name>Seaside%20Lot</name> <income>$8,000</income> </land> − <land> <id>14</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fbig%2Fempty%5Ffield%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Empty%20Field%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%24100%2C000%3C%2Fspan%3E%3Cbr%3E </details> <num_owned>0</num_owned> <is_racket/> <cost>75000000</cost> <favor_points>0</favor_points> <name>Empty%20Field</name> <income>$100,000</income> </land> − <land> <id>23</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fbig%2Foverseas%5Flot%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Overseas%20Lot%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%2450%2C000%3C%2Fspan%3E%3Cbr%3E </details> <num_owned>0</num_owned> <is_racket/> <cost>50000000</cost> <favor_points>0</favor_points> <name>Overseas%20Lot</name> <income>$50,000</income> </land> </undeveloped_lands> − <establishments> − <land> <id>24</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fundersea%5Fsmuggling%5Fstation%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Undersea%20Smuggling%20Station%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%24100%2C000%2C000%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landBuiltOn%27%20style%3D%27color%3A%23FFFFFF%27%3EBuilt%20On%3A%20Seaside%20Lot%3C%2Fspan%3E </details> <num_owned>40</num_owned> <cost>200000000000</cost> <is_racket>false</is_racket> <favor_points>0</favor_points> <name>Undersea%20Smuggling%20Station</name> <income>$100,000,000</income> <built_on>Seaside%20Lot</built_on> <enhancements/> </land> − <land> <id>17</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fbig%2Fnewsstand%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Newsstand%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%24100%3C%2Fspan%3E%3Cbr%3E </details> <num_owned>5410</num_owned> <is_racket/> <cost>813000</cost> <favor_points>0</favor_points> <name>Newsstand</name> <income>$100</income> </land> − <land> <id>3</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fbig%2Ftownhomes%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Townhomes%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%24300%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landBuiltOn%27%20style%3D%27color%3A%23FFFFFF%27%3EBuilt%20On%3A%20Vacant%20Lot%3C%2Fspan%3E </details> <num_owned>2610</num_owned> <is_racket/> <cost>2358000</cost> <favor_points>0</favor_points> <name>Townhomes</name> <income>$300</income> <built_on>Vacant%20Lot</built_on> </land> − <land> <id>4</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fbig%2Fresturant%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Ristorante%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%24700%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landBuiltOn%27%20style%3D%27color%3A%23FFFFFF%27%3EBuilt%20On%3A%20Vacant%20Lot%3C%2Fspan%3E </details> <num_owned>2180</num_owned> <is_racket/> <cost>5475000</cost> <favor_points>0</favor_points> <name>Ristorante</name> <income>$700</income> <built_on>Vacant%20Lot</built_on> </land> − <land> <id>5</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fbig%2Fcondos%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Condo%20Complex%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%245%2C000%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landBuiltOn%27%20style%3D%27color%3A%23FFFFFF%27%3EBuilt%20On%3A%20Empty%20Storefront%3C%2Fspan%3E </details> <num_owned>2430</num_owned> <is_racket/> <cost>39040000</cost> <favor_points>0</favor_points> <name>Condo%20Complex</name> <income>$5,000</income> <built_on>Empty%20Storefront</built_on> </land> − <land> <id>6</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fbig%2Fhotel%5Fv3%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Luxury%20Hotel%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%2410%2C000%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landBuiltOn%27%20style%3D%27color%3A%23FFFFFF%27%3EBuilt%20On%3A%20Empty%20Storefront%3C%2Fspan%3E </details> <num_owned>2210</num_owned> <is_racket/> <cost>77700000</cost> <favor_points>0</favor_points> <name>Luxury%20Hotel</name> <income>$10,000</income> <built_on>Empty%20Storefront</built_on> </land> − <land> <id>18</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fbig%2Foffice%5Fbuilding%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Office%20Building%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%2420%2C000%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landBuiltOn%27%20style%3D%27color%3A%23FFFFFF%27%3EBuilt%20On%3A%20Vacant%20Lot%3C%2Fspan%3E </details> <num_owned>1290</num_owned> <is_racket/> <cost>156000000</cost> <favor_points>0</favor_points> <name>Office%20Building</name> <income>$20,000</income> <built_on>Vacant%20Lot</built_on> </land> − <land> <id>7</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fbig%2Fsky%5Fscraper%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Skyscraper%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%24170%2C000%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landBuiltOn%27%20style%3D%27color%3A%23FFFFFF%27%3EBuilt%20On%3A%20Plaza%3C%2Fspan%3E </details> <num_owned>720</num_owned> <is_racket/> <cost>1314000000</cost> <favor_points>0</favor_points> <name>Skyscraper</name> <income>$170,000</income> <built_on>Plaza</built_on> </land> − <land> <id>8</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fbig%2Fcasino%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Resort%20Casino%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%24350%2C000%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landBuiltOn%27%20style%3D%27color%3A%23FFFFFF%27%3EBuilt%20On%3A%20Plaza%3C%2Fspan%3E </details> <num_owned>590</num_owned> <is_racket/> <cost>2700000000</cost> <favor_points>0</favor_points> <name>Resort%20Casino</name> <income>$350,000</income> <built_on>Plaza</built_on> </land> − <land> <id>10</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fbig%2Fshipping%5Fyard%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Shipyard%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%2420%2C000%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landBuiltOn%27%20style%3D%27color%3A%23FFFFFF%27%3EBuilt%20On%3A%20Seaside%20Lot%3C%2Fspan%3E </details> <num_owned>250</num_owned> <is_racket/> <cost>156000000</cost> <favor_points>0</favor_points> <name>Shipyard</name> <income>$20,000</income> <built_on>Seaside%20Lot</built_on> </land> − <land> <id>11</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fbig%2Fharbor%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Yacht%20Harbor%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%2450%2C000%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landBuiltOn%27%20style%3D%27color%3A%23FFFFFF%27%3EBuilt%20On%3A%20Seaside%20Lot%3C%2Fspan%3E </details> <num_owned>780</num_owned> <is_racket/> <cost>395000000</cost> <favor_points>0</favor_points> <name>Yacht%20Harbor</name> <income>$50,000</income> <built_on>Seaside%20Lot</built_on> </land> − <land> <id>12</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fbig%2Fresort%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Seaside%20Resort%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%24200%2C000%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landBuiltOn%27%20style%3D%27color%3A%23FFFFFF%27%3EBuilt%20On%3A%20Seaside%20Lot%3C%2Fspan%3E </details> <num_owned>760</num_owned> <is_racket/> <cost>1540000000</cost> <favor_points>0</favor_points> <name>Seaside%20Resort</name> <income>$200,000</income> <built_on>Seaside%20Lot</built_on> </land> − <land> <id>13</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fbig%2Fmall%5Fv3%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Downtown%20Shopping%20Mall%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%24500%2C000%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landBuiltOn%27%20style%3D%27color%3A%23FFFFFF%27%3EBuilt%20On%3A%20Plaza%3C%2Fspan%3E </details> <num_owned>750</num_owned> <is_racket/> <cost>3800000000</cost> <favor_points>0</favor_points> <name>Downtown%20Shopping%20Mall</name> <income>$500,000</income> <built_on>Plaza</built_on> </land> − <land> <id>19</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fbig%2Fland%5Fmark%5Fcasino%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Landmark%20Casino%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%24550%2C000%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landBuiltOn%27%20style%3D%27color%3A%23FFFFFF%27%3EBuilt%20On%3A%20Empty%20Field%3C%2Fspan%3E </details> <num_owned>400</num_owned> <is_racket/> <cost>4100000000</cost> <favor_points>0</favor_points> <name>Landmark%20Casino</name> <income>$550,000</income> <built_on>Empty%20Field</built_on> </land> − <land> <members_req>50</members_req> <id>15</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fbig%2Fhelipad%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Helipad%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%24600%2C000%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landBuiltOn%27%20style%3D%27color%3A%23FFFFFF%27%3EBuilt%20On%3A%20Vacant%20Lot%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%3EEach%20Requires%2050%20Mob%20Members </details> <num_owned>12</num_owned> <is_racket/> <cost>660000000</cost> <favor_points>0</favor_points> <name>Helipad</name> <income>$600,000</income> <built_on>Vacant%20Lot</built_on> </land> − <land> <members_req>60</members_req> <id>16</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fbig%2Fairport%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Airport%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%241%2C000%2C000%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landBuiltOn%27%20style%3D%27color%3A%23FFFFFF%27%3EBuilt%20On%3A%20Empty%20Field%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%3EEach%20Requires%2060%20Mob%20Members </details> <num_owned>10</num_owned> <is_racket/> <cost>1800000000</cost> <favor_points>0</favor_points> <name>Airport</name> <income>$1,000,000</income> <built_on>Empty%20Field</built_on> </land> − <land> <id>22</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fbig%2Fforeign%5Fembassy%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Foreign%20Embassy%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%242%2C000%2C000%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landBuiltOn%27%20style%3D%27color%3A%23FFFFFF%27%3EBuilt%20On%3A%20Overseas%20Lot%3C%2Fspan%3E </details> <num_owned>100</num_owned> <is_racket/> <cost>16500000000</cost> <favor_points>0</favor_points> <name>Foreign%20Embassy</name> <income>$2,000,000</income> <built_on>Overseas%20Lot</built_on> </land> </establishments> <featured_lands/> − <locked_lands> − <land> <id>20</id> − <image_url> http%3A%2F%2Fcdn0%2Emobwarsapp%2Ecom%2Frpg%5Fimages%2Fopensocial%2Fmob%2Fingame%2Fterritory%2Fbig%2Fcatskill%5Fresort%2Egif </image_url> − <details> %3Cspan%20class%3D%27landName%27%20style%3D%27color%3A%23FFFFFF%3B%20font%2Dsize%3A18px%3B%20font%2Dweight%3Abold%3B%27%3E%20Catskill%20Resort%3C%2Fspan%3E%3Cbr%3E%3Cspan%20class%3D%27landIncome%27%20style%3D%27color%3A%23FFFFFF%27%3EIncome%3A%20%2425%2C000%3C%2Fspan%3E%3Cbr%3E </details> <num_owned>0</num_owned> <is_racket/> <cost>0</cost> <no_sell>true</no_sell> <favor_points>0</favor_points> <name>Catskill%20Resort</name> <income>$25,000</income> − <enhancements> − <enhancement> <value>2</value> <suffix>max energy</suffix> <prefix>+</prefix> <type>MAX_ENERGY_INCREASE</type> </enhancement> </enhancements> </land> </locked_lands> <num_mob_used>1200</num_mob_used> <num_mob_available>238</num_mob_available> <update_period>55</update_period> <minutes_to_update>9</minutes_to_update> <get_city_list>true</get_city_list> <request_id>7215441</request_id> </xml> </outer> How can I access the id part? <EXM id="1233456"><products>...</products></EXM> Hello requinix. I am taking advantage of this thread to expose my problem: It looks like the load function does NOT work properly and I CANNOT find the reason why: Code: [Select] $xml = new DOMDocument(); $xml->load("data/slides.xml"); In debugging, I can see the creation of a DOMDocument but the load function does not fill the $xml with the relative data even if it returns True: Code: [Select] <?xml version="1.0" encoding="UTF-8"?> <album> <slide url="data/327.jpg" rel_URL="show_craft.php?id=327" title="Art. 327"></slide> <slide url="data/330.jpg" rel_URL="show_craft.php?id=330" title="Art. 330"></slide> <slide url="data/311.jpg" rel_URL="show_craft.php?id=311" title="Art. 311"></slide> <slide url="data/239.jpg" rel_URL="show_craft.php?id=239" title="Art. 239"></slide> <slide url="data/275.jpg" rel_URL="show_craft.php?id=275" title="Art. 275"></slide> <slide url="data/IMG_2691.jpg" rel_URL=" " title="Art. IMG_2691"></slide> <slide url="data/IMG_2684.jpg" rel_URL=" " title="Art. IMG_2684"></slide> <slide url="data/crafts 023.jpg" rel_URL=" " title="Art. crafts 023"></slide> </album> I use XAMPP 1.7.7. In php.net, under DOMDocument::load page, there is a post that says "Function will not work if using XML DOM PECL module". In my phpinfo() there is only the "PECL Module version 2.0-dev $Id: sqlite.c 306939 2011-01-01 02:19:59Z felipe $ " under SQLite section enabled. I tried many things like changing xml path, replacing the xml file with a simpler one from, for example, w3schools but with no avail. I still get an empty document. I don't know where to bang my head since it looks like it's only me having this issue (search the web extensively). Any help is greatly appreciated. Thank you what is wrong with this code? I want to parse rss content and its giving error that, the input is not corret $xmlDoc = new DOMDocument(); $xml="http://www.pharmamanufacturing.com/index.html?mode=rss"; $xmlDoc->loadxml($xml); //$xmlDoc->load($xml); Hi I have an XML file that I've been trying to parse with some success. Code: [Select] <?xml version='1.0' encoding='ISO-8859-1'?> <Notes> <Madrid> <trip> <ID>12518980</ID> <Duration>130</Duration> </trip> <trip> <ID>12518981</ID> <Duration>600</Duration> </trip> <trip> <ID>12518982</ID> <Duration>50</Duration> </trip> </Madrid> <London> <trip> <ID>12518983</ID> <Duration>Suzuki</Duration> </trip> </London> <Chicago> <trip> <ID>12518984</ID> <Duration>1600</Duration> </trip> <Chicago> </Notes> I am able to get all the nodes that I want, which is mainly ID and duration using: Code: [Select] $objDOM = new DOMDocument(); $objDOM->load("data.xml"); $note = $objDOM->getElementsByTagName("trip"); foreach( $note as $value ) { $ids = $value->getElementsByTagName("ID"); $id = $ids->item(0)->nodeValue; $durations = $value->getElementsByTagName("Duration"); $duration = $duration->item(0)->nodeValue; echo "ID is:".$id."<br />"; echo "Duration is:".$duration."<br />"; } What I'd really like to do, is to the get duration and ID for each of the parent nodes, i.e. Mardid, London and Chicago, without having 3 separate foreach loops, if that is possible? |