|
Ok, I've been staring at that for ages and my logic has vanished...
I re wrote it to this the below....
Only problem is that I still don't get a valid response..
the array is of the form :
[1] => Array ( [Name ] => Aberdeen [Status ] => Ready [Location ] => [Jobs ] => 0 [Model ] => HPUniversalPrintingPCL6 [Comment ] => PRINT_EARL
The correct number of "@" are retuned so it's performing the correct number of itterations, but no giving me the results...
I should have mentioned that I'm completely new to PHP and am kinda winging it....
Start of code chunk
$it = new RecursiveIteratorIterator( new RecursiveArrayIterator($server1));
echo "<table border='1'>";
foreach ($it as $key=>$val)
{
echo "@";
if ($val == "PRINT_EARL")
{
echo "<tr>";
echo "<td>";
echo $key;
echo "</td>";
echo "<td>";
echo $val;
echo "</td>";
echo "</tr>";
}
Else
echo $key.":".$val."\n";
}
End of code chunk
-- Modified Monday, May 3, 2010 10:51 AM
|
|
|
|
|
hi
i have written code in php to open a pdf file in browser
echo "<a href="pdf/abc.pdf">pdf</a>";
its not open pdf only start download file and after that i can open that file but i want to show this file on my browser while there is no iframe or other content please help me to show not download direct when i try to down load than download.
please suggest code for me
|
|
|
|
|
Google is your friend. Search for 'content-disposition header'. That's what tells the browser how to treat the pdf (or at least suggests). There is a php function to write the header.
|
|
|
|
|
Following code will be helpful to open pdf file.
<?php
// when form submitted, redirect to PDF file
if($file=="dick.pdf" || $file=="andrea.pdf" || $file=="lewis.pdf")
{
header("Location: $file");
exit();
}
// and else just display the thing
?>
<html>
<head>
<title>Download a PDF file</title>
</head>
<body>
<form action="thisfile.php" method="get">
<fieldset>
<legend>Please select a PDF file to download</legend>
<select name="file" size="1">
<option value="dick.pdf">Dick</option>
<option value="andrea.pdf">Andrea</option>
<option value="lewis.pdf">Lewis</option>
</select>
<input type="submit" value="Download!">
</form>
</body>
</html>
Hope this will help!
Jinal Desai
|
|
|
|
|
I don't know if it was you who 1-voted my reply, but I was at least answering the question the OP asked. He showed that he can write php to serve the pdf file. What he wants to do is to get the browser to display the file rather than offer a download. The way to do this is through the content-disposition header as I indicated.
|
|
|
|
|
Never mind my friend.
I am not here to vote anyone, I am just replying on what I know.
Jinal Desai - LIVE
|
|
|
|
|
PDF required adobe or post script plugin, close your browser and install adobe reader or some plugin that have pdf support for your browser., The second choice better you write book renderer like google books, this require ajax to load images that you created before , OR you can hunt library that can display pdf on the fly... REGARD!!!!
|
|
|
|
|
Friends , I have a code which uses Depreciated functions:
I have Marked that code BOLD, please help me if you could provide alternative statements to them ... like through PREG..
Please Help..
if (ereg("HTTP/[0-9.]+ (([0-9])[0-9]{2})", $answer, $regs)) {
$httpcode = $regs[2];
full_httpcode = $regs[1];
if ($httpcode <> 2 && $httpcode <> 3) {
$status['state'] = "Unreachable: http $full_httpcode";
$linkstate = "Unreachable";
}
}
if (ereg("Location: *([^\n\r ]+)", $answer, $regs) && $httpcode == 3 && $full_httpcode != 302) {
$status['path'] = $regs[1];
$status['state'] = "Relocation: http $full_httpcode";
fclose($fp);
return $status;
}
if (eregi("Last-Modified: *([a-z0-9,: ]+)", $answer, $regs)) {
$status['date'] = $regs[1];
}
if (eregi("Content-Type:", $answer)) {
$content = $answer;
$answer = '';
break;
}
if (eregi("Content-Type: *([a-z/.-]*)", $content, $regs)) {
if ($regs[1] == 'text/html' || $regs[1] == 'text/' || $regs[1] == 'text/plain') {
$status['content'] = 'text';
$status['state'] = 'ok';
} else if ($regs[1] == 'application/pdf' && $index_pdf == 1) {
$status['content'] = 'pdf';
$status['state'] = 'ok';
} else if (($regs[1] == 'application/msword' || $regs[1] == 'application/vnd.ms-word') && $index_doc == 1) {
$status['content'] = 'doc';
$status['state'] = 'ok';
} else if (($regs[1] == 'application/excel' || $regs[1] == 'application/vnd.ms-excel') && $index_xls == 1) {
$status['content'] = 'xls';
$status['state'] = 'ok';
} else if (($regs[1] == 'application/mspowerpoint' || $regs[1] == 'application/vnd.ms-powerpoint') && $index_ppt == 1) {
$status['content'] = 'ppt';
$status['state'] = 'ok';
} else {
$status['state'] = "Not text or html";
}
Please HELP me soon ..please REPLY!!!
|
|
|
|
|
is Google not working where you are? it gave me many links including this one[^].
|
|
|
|
|
Well friend i am googling from 5 days.
And i have found many links and studied them too.
and these BOLD queries that i have mentioned
are not being able to be resolved by me..
Actually i have to look for alternative for these
expression!!!
Hope u can help....with some solution or with a link which could
guide me how to resolve them!!
Its a new change by PHP and I can't catch it so soon..
So please help me
Or you can do another thing...
I am using XAMPP with php 5.3
is there any way to stop displaying those deprecated errors
|
|
|
|
|
I use XAMPP myself, however I don't want to hide error or warning messsages, I work on my code to avoid them in the first place.
From the link I provided it seems the new ereg and the old preg stuff is very similar; so I suggest you study where they differ and fix things in your code. Start with the very first occurence and fix that. From then on, it should be easy.
|
|
|
|
|
USE : PERL REGEX , preg_replace,preg_match; HONEY
|
|
|
|
|
hello all,
I want to know which is the best php framework to use in any
general php project.
The project size lies between medium scale project to
large scale project.
So from overall points of all frameworks like ease of use
to scalability, which is best ??
Jinal Desai
|
|
|
|
|
There is literally dozens of PHP Frameworks. Decide what you need and try to match it from this comparison site, then make your choice(s) http://www.phpframeworks.com/[^]
modified 1-Aug-19 21:02pm.
|
|
|
|
|
Thanks It will help me a lot.
Jinal Desai
|
|
|
|
|
|
I'm not even really being sarcastic when I say there isn't a best one, and you'll probably hate them all and eventually convince yourself that your only recourse is to write your own.
Honestly Illustrated
<Pretentious> Raid tha manyuhl. :E
<Pretentious> Aw raid eh own mah meaxbile. :E
|
|
|
|
|
hello, i am in the process of making a download counter for external link, so when the user clicks the link to dilesharing site the download is noted and 1 is added to the mysql database ...
here is how i make the id...
echo"<a href=\"download_count.php?id=". $row['upload_id'] . "\">Download</a>";
now i get this when i click download ...
http://localhost/website/download_count.php?id= 54
now thats related to the record in a mysql databas, as you have probably guessed ....
how do i get that id in the url so i can use it in the download_count.php file which will allow me to make a function to add 1 ??
thanks for all your help in advance ...
|
|
|
|
|
a little Google action would have yielded pages such as this one[^].
|
|
|
|
|
hello guys....can we install Zorine OS on virtualbox??...thanx for the answer
|
|
|
|
|
Yes.
However, as seen as it will be running in a VM, you should find out if the OS supports the virtual hardware (ie. network adapters).
|
|
|
|
|
I have a great website that is my capture page. Others would like to use it also. How do I add a parameter that would allow me to add a user to my site like website.com/username..
I'm normally a .net programmer, this is my first php programm..
Could I have an code sample too...
Thanks..
|
|
|
|
|
Are you talking about a parameter (GET or POST) or somehow fiddling with the URL? I'm not sure I follow what you want to do.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
I want to have 3 or 4 people to sell products from my website by sending others to view it. They need to send them there with a link that contains an input parameter that is their id so they can get credit for the online sale. So what is the best way to do this?
|
|
|
|
|
I'd probably use a HIDDEN field to send a GET or POST parameter to a PHP page that looks at the parameter and figures out who to give credit to, then sends them on to the link.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|