PHP - Read And Echo Xml Not Working
My variable which should be storing XML data and echos it to the screen is echoing the data as a string without the XML structure Below is my code but it is still not working:
Code: [Select] $view = $_GET['view']; $xml_data = "http://www.website.com/STRATA/" . $view .".xml"; $handle = fopen($xml_data, 'r'); $Data = fread($handle, 10000); fclose($handle); echo $Data; Similar Tutorialshi there all. hope i can get your help. i am creating a php page that talks to mysql tabes. i want to print query into my html page inside html tags. the first echo in my code works but the one embedded inside the html code prints nothing to the page. look at my code if it helps: <html><body> <?php mysql_connect("localhost", "root", "123456") or die("Connection Failed"); mysql_select_db("man_utd")or die("Connection Failed"); $name = $_POST['members']; $query = "select * from members where username = 'burns'"; $result = mysql_query($query); while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { echo $line['pass']; } ?> <table border="0" cellspacing="2" cellpadding="2"> <tr> <th><font face="Arial, Helvetica, sans-serif"><?php echo $line['pass']; ?></font></th> <th><font face="Arial, Helvetica, sans-serif">Value2</font></th> <th><font face="Arial, Helvetica, sans-serif">Value3</font></th> <th><font face="Arial, Helvetica, sans-serif">Value4</font></th> <th><font face="Arial, Helvetica, sans-serif">Value5</font></th> </tr> </body> </html> thanks all for any help echo will not print out a value. I do the simple string " " and it doesn't even do that. It's just blank in my browser. I use netbeans and firefox and chrome. Any idea as to what I'm doing wrong? Simple code snippet: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <title>PHP Testing</title> </head> <body> <?php echo "print me"; ?> </body> </html> Thanks for any future help. Please help, when I run this search and enter something in the search thats not in the database, it doesnt reply with "Your query returned 0 results" as it should. I tjust stays blank Here's the section of code in question... if ($search) // perform search only if a string was entered. { mysql_connect($host, $user, $pass) or die ("Problem connecting to Database"); $srch="%".$search."%"; $query = "select * from tvads WHERE advert LIKE '$srch' ORDER BY advert, year DESC, details ASC LIMIT 0,30"; $result = mysql_db_query("cookuk_pn", $query); if ($result) { $count = 1; print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#0000FF\" width=\"900\">"; print "<tr><td width=\"200\" height=\"30\" align=\"left\"><u><b><font face=\"arial\" size=\"2\" color=\"#800080\">Advert / Description</font></b></u></td>"; print "<td width=\"80\" align=\"left\"><u><b><font face=\"arial\" size=\"2\" color=\"#800080\">Year</font></b></u></td>"; print "<td width=\"200\" align=\"left\"><u><b><font face=\"arial\" size=\"2\" color=\"#800080\">Artist</font></b></u></td>"; print "<td width=\"200\" align=\"left\"><u><b><font face=\"arial\" size=\"2\" color=\"#800080\">Track</font></b></u></td>"; print "<td width=\"80\" align=\"left\"><u><b><font face=\"arial\" size=\"2\" color=\"#800080\">Buy Album</font></b></u></td>"; print "<td width=\"100\" align=\"left\"><u><b><font face=\"arial\" size=\"2\" color=\"#800080\">Download MP3</font></b></u></td></tr>"; while ($row = mysql_fetch_array($result)) { // Begin while $data .= "<td width=\"200\" height=\"30\" align=\"left\"><font face=\"arial\" size=\"1\">" .$row['advert']. "</font><br>"; $data .= "<font face=\"arial\" size=\"1\" color=\"#000080\"><i>" .$row['details']. "</i></font></td>"; $data .= "<td width=\"80\" height=\"30\" align=\"left\"><font face=\"arial\" size=\"1\">" .$row['year']. "</font></td>"; $data .= "<td width=\"200\" height=\"30\" align=\"left\"><font face=\"arial\" size=\"1\">" .$row['artist']. "</font></td>"; $data .= "<td width=\"200\" height=\"30\" align=\"left\"><font face=\"arial\" size=\"1\">" .$row['track']. "</font></td>"; $data .= "<td width=\"80\" height=\"30\" align=\"left\"><font face=\"arial\" size=\"1\">" .$row['asin_ref']. "</font></td>"; $data .= "<td width=\"100\" height=\"30\" align=\"left\"><font face=\"arial\" size=\"1\">" .$row['mp3_ref']. "</font></td></tr>"; $count++; } // end while $data .="</table>"; echo $data; } else { echo "problems...."; } } else { echo "Your query returned 0 Results"; } ?> This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=320829.0 Hello all, I'm passing variables through a URL. This will work: echo $v4; But neither of these will: echo "<a href='test.php?v4=$v4'>Places</a>"; echo "<a href='test.php?v4=".$v4."> Places</a>"; It WILL work if I hardcode v4, like so: echo "<a href='test.php?v4=Utah'>Places</a>"; But that's useless to me, as I don't want to have to write 50 If statements for every database entry. Does anyone know how to fix this? Thanks! Hi, Im trying to pull an email from an url, and then echo the email as value into a email form-- under the "from" heading. The echo is not working i get blanks. here is the code: <?php $thisurl='$_SERVER['REQUEST_URI']'; $thepart = explode('/', $thisurl); $themail='$thepart[2]'; ?> <form method="post" action="sendit.php"> To: <br><input type="text" name="to" size="44" value="<?php for($i=1; $i<=$lines; $i=$i+1) { $names[$i] = str_replace("<br>", "", $names[$i]); $names[$i] = str_replace("\n", "", $names[$i]); echo $names[$i].';'; } ?>"><br> From: <br><input type="text" name="email" size="44" value="<?php echo '$themail'; ?>" readonly><br> Subject: <br><input type="text" name="subject" size="44" /><br><br> Hi, This is my first post in this forum and am a PHP beginner. I have written a script in php and need to use echo to see the values of variables etc. However I dont get the output on the screen while using echo . I am using Xampp server with Apache. The startup.html file code is
<!DOCTYPE HTML>
</head>
and the test.php code is <?php
$lat = $_REQUEST['latitude'];
echo 'latitude- '.$lat . ', longitude- ' . $lon; Please help regards
Sanjish Hello,
I try to get website speed of some website, but i can read only ''domain.com'' i can't read website files like css , js ... why ? i use proxies for this job.
here is the php code:
$options = array( 'useragent' => "Firefox (+http://www.firefox.org)", // who am i 'connecttimeout' => 120, // timeout on connect 'timeout' => 120, // timeout on response 'redirect' => 10, // stop after 10 redirects 'referer' => "http://www.google.com", 'proxyhost' =>'85.25.8.14:80' ); $response = http_get("http://solve-ict.com/wp-content/themes/ict%20theme/js/jquery-1.7.1.min.js", $options , $info);but it works fine with http://domain.com/ , but with files css or js it gives 404, using some free proxy servers available ? Thanks. Trying to get this done: Page_1 has many external links, when certain links are clicked i do not want user to go directly to page, but rather go to a special add page_2 where user must click a second time on the link to finally get there. The add page_2 must show on screen the name of the initial link from page_1, it must change accordingly with the link it came from page_1,once on page_2 the hyperlink redirects outside the site. So far i am thinking give an id to the div or "<a href..." on page_1 then somehow have page_2 detect that id and fill in the variable for the final external link. Other wise is there a way to detect a url from incoming? I guess a similar example is how some domain name sellers landing page will indicate the name of the site. Such as "Thisdomain.com" is for sale. same landing page but the name changes according to the domain that was typed. OK, have no idea what's going on... I've done this a million times... why wont this output!?? I must have a major brain meltdown and dont know it yet!!! Code: [Select] <?php // this echoes just fine: echo $_POST['testfield']; // but this wont echo: echo if (isset($_POST['testfield'])) { $_POST['testfield'] = $test; } echo $test; /// or even this DOESNT echo either!: $_POST['testfield'] = $test; echo $test; ?> I got a question im using izabi for me im one who loves the software. But there some quirks that they forgot to add when making the mail system. I was wondering how it would be possible to code in a peice of php where it says read after someone read the email. If you need a copy of the mail mail script let me know. Hi All, I'm trying to echo the response from an SLA query, the query works and returns the data when I test it on an SQL application.. but when I run it on my webpage it won't echo the result. Please help? <?php $mysqli = mysqli_connect("removed", "removed", "removed", "removed"); $sql = "SELECT posts.message FROM posts INNER JOIN threads ON posts.pid=threads.firstpost WHERE threads.firstpost='1'"; $result = mysqli_query($mysqli, $sql); echo {$result['message']}; ?> I have a log system that allows 10 logs on each side(Left and right). I am trying to make it so that the left side has the 10 most recent logs, then the right as the next 10. Any ideas? So I need to echo a row from my database with php, but where i need to echo is already inside an echo. This is my part of my code: $con = mysql_connect("$host","$username","$password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("main", $con); $result = mysql_query("SELECT * FROM Vendor"); while($row = mysql_fetch_array($result)) { //I need to echo right here .................. but I get a blank page when I try this. Please Help. echo '<option value=$row['vendor_id']>'; echo $row['vendor_id']; echo '</option>'; } mysql_close($con); Result: A Blank page. Thanks in advance! Hi
I try to echo out random lines of a html file and want after submit password to whole content of the same html file. I have two Problems.
1st Problem When I echo out the random lines of the html file I don't get just the text but the code of the html file as well. I don't want that. I just want the text. How to do that?
for($x = 1;$x<=40;$x++) { $lines = file("$filename.html"); echo $lines[rand(0, count($lines)-1)]."<br>"; }I tried instead of "file("$filename.html");" "readfile("$filename.html");" But then I get the random lines plus the whole content. Is there anything else I can use instead of file so that I get the random lines of text without the html code?P.S file_get_contents doesn't work either have tried that one. 2nd Problem: As you could see in my first problem I have a file called $filename.html. After I submit the value of a password I want the whole content. But it is like the program did forget what $filename.html is. How can I make the program remember what $filename.html is? Or with other words how to get the whole content of the html file? My code: if($_POST['submitPasswordIT']){ if ($_POST['passIT']== $password ){ $my_file = file_get_contents("$filename.html"); echo $my_file; } else{ echo "You entered wrong password"; } }If the password isn't correct I get: You entered wrong password. If the password is correct I get nothing. I probably need to create a path to the file "$filename.html", but I don't know exactly how to do that. hi, i am requesting bookrenter.com with curl and getting back a response in something like xml format The response is Code: [Select] <response> <book> <info> <isbn13>9780324786453</isbn13> <isbn10>032478645X</isbn10> </info> <prices> <rental_price days="45">$17.43</rental_price> <rental_price days="90">$24.35</rental_price> <rental_price days="60">$20.87</rental_price> <rental_price days="30">$15.87</rental_price> <rental_price days="125">$28.99</rental_price> </prices> <lowest_shipping_price>$0.00</lowest_shipping_price> <availability>In Stock</availability> <url>http://www.shareasale.com/r.cfm?u=&b=96706&m=14293&urllink=www.bookrenter.com%2Fdiscovering-computers-2010-living-in-a-digital-world-complete-shelly-cashman-series-032478645X-9780324786453</url> </book> </response> Now i want to process the response so that it will show the values in user readable form like 45 day's rent is $17.43 90 day's rent is $24.35 60 day's rent is $20.87 30 day's rent is $15.87 125 day's rent is $28.99 Shipping price is $0.00 please help Thanks hi, there is a script or something that can read this file? http://ical.imac.com/ical/portuguese32holidays.ics the ideia is to save all days and holidays for a mysql and then update time to time. thanks for your help this is what i have so far: Code: [Select] $var=$_POST["fname"]; $xmlDoc = new DOMDocument(); $xmlDoc->loadXML($var); I would like to use something similar to this included in it before sql insert: Code: [Select] for($c = 0; $c<$node->length; $c++) { 1 root, 4 parents and varying childs I believe? Code: [Select] <node> <building>Number 65</building> <workers><label>executive</label><names>john</names><label>cook</label><names>terry</names><label>waitress</label><names>jill</names><label>buser</label><names>4564646</names><label>Main</label><number>45564646</number><label>home fax</label><number>45964646</number></workers> <food><label>breakfast</label><meal>eggs</meal><label>lunch</label><meal>turkey</meal><label>dinner</label><meal>steak</meal></food> <addresses><label>Home</label><Country>usa</Country><Street>123 mulberry ln </Street><ZIP>57888</ZIP><City>teledo</City><State>Ohio</State><label>location</label><Street>turnpike east 23</Street><City>danbury</City><State>Connecticut</State><Country>USA</Country></addresses> <building>Number 66</building> etc... </node> Thank you! Hi everyone, I need some help here. I don't know PHP coding and how to write custom php code for reading a XML in PHP. I have a application which updates the server status in real time and send out the data in XML format. I want to create a PHP page so that can show the data in XML to frontend user... I am pasting the XML code that need to be converted in PHP. Any kind of help will be appreciated. If anybody can give me the code and displaying the data in table format that will be awesome.... Code: [Select] <?xml version="1.0" encoding="UTF-8"?> -<simplehelp_metrics builddate="20120419-123521" version="3.12"> -<technician_metrics> <metric value="2" name="Technicians Logged In" id="tech_logged_in"/> <metric value="0" name="Technicians In Session" id="tech_in_session"/> <metric value="0" name="Technicians In Remote Session" id="tech_in_remote_session"/> </technician_metrics> -<customer_metrics> <metric value="0" name="Customers Logged In" id="cust_logged_in"/> <metric value="0" name="Customers In Session" id="cust_in_session"/> <metric value="0" name="Customers Waiting" id="cust_waiting"/> </customer_metrics> -<server_metrics> <metric value="1" name="Server Maximum Sessions" id="server_max_sessions"/> <metric value="23" name="Server Total Number of Sessions" id="server_total_sessions"/> <metric value="23" name="Server Total Number of Support Sessions" id="server_total_support_sessions"/> <metric value="0" name="Server Total Number of Access Sessions" id="server_total_access_sessions"/> <metric value="21217" name="Average Queue Time" id="server_average_queue_time"/> <metric value="17052" name="Last Queue Time" id="server_last_queue_time"/> <metric value="1830883" name="Average Session Duration" id="server_average_session_time"/> <metric value="5932145" name="Last Session Duration" id="server_last_session_time"/> </server_metrics> -<technicians> <technician name="tlc10271" login="tlc10271"/> <technician name="tlc10072" login="tlc10072"/> </technicians> </simplehelp_metrics> i have this code Code: [Select] <?xml version="1.0" encoding="UTF-8" ?> <rss version="2.0"> <channel> <item> <title> tttt1</title> <link>lll1</link> <description> dddd1 </description> </item> <item> <title> tttt2</title> <link>lll2</link> <description> dddd2 </description> </item> <item> <title> tttt3</title> <link>lll3</link> <description> dddd3 </description> </item> and i want go get to array all the details tttt1 lll1 dddd1 tttt2 lll2 dddd2 tttt3 lll3 dddd3 how can i do that simple? I SEE THIS http://il2.php.net/xml_parse but 1)i dont understand this how can i do what i want 2) it is too long and class code i need short and simple please help |