echo

Using PHP's echo as a web service

It's way too much work to create a restful web service. Why can't we just create a simple php page which receives requests and simply echos the JSON string. for example: <?php $action = $_POST['action']; if (action == "users") { //get all users from DB and echo a JSON string } else if (action = "ads") ...

X_VERIFY_CREDENTIALS_AUTHORIZATION - where can i get those values?

A curl HEADER should contain the following: oauth_consumer_key="YOUR KEY HERE", oauth_signature_method="HMAC-SHA1", oauth_token="YOUR TOKEN HERE", oauth_timestamp="TIMESTAMP", oauth_nonce="OAUTH NONCE", oauth_version="1.0", oauth_signature="SIGNATURE" where can i get the consumer_key, a valid oauth_token, timestamp, ...

PHP ECHO VARIABLE

I managed to create a new line for each only with : $content1= hot("britney") ? "britney found" : ""; $content2= hot("gaga") ? "gaga found" : ""; $content3= hot("carol") ? "carol found" : ""; $filename = 'result.txt'; $handle = fopen($filename, 'a'); fwrite($handle, "$Content1\r\n"); fwrite($handle, "$Content2\r\n"); fwrite($handle, "...

remove remainder from string in php

Hi. Simple question. I have this code: total = 41 win = 48 echo ($total/$win) * 100 ; printing out 85.416666666667 I need to remove the remainder so it prints out: 85 %. ...

help sending command to process using /proc

I have an application which runs as a process on a ubuntu server. This application has command line gui which allows me to type in a command, then press enter and the command runs. I am able to script the determination of the process id. I then script the following to send it a command: # echo "command" > /proc/<PROCESSID>/fd/0 I have...

PHP Contact Form - Want to stay on my site after send

I am in the process of creating a PHP contact form and all I have is that little problem, with the php script I have, that when the email was send out a new "Thank you" page is called.So the actual site with the contact form disappears BUT I DON`T WANT THAT HAPPEN.If the send button is hit I want to stay on my site, showing an empty cont...

Possible to capture PHP echo output ?

So I have a function such as: public static function UnorderedList($items, $field, $view = false){ if(count($items) > 0){ echo '<ul>'; foreach($items as $item){ echo '<li>'; if($view){ echo '<a href="'.$view.'id='.$item->sys_id.'" title="View Item">'.$item->$field.'</a>'; ...

php headers_sent function is not working

<h1>Header</h1> <?php echo 'teste'; // output here echo headers_sent(); // no output here! ?> Why headers_sent() doesn't output in this case? Thank you. ...

How to echo in PHP, html tags

I went through this before posting: http://stackoverflow.com/questions/1100354/easiest-way-to-echo-html-in-php And still could make sense of it. I´m trying to echo this: <div> <h3><a href="#">First</a></h3> <div>Lorem ipsum dolor sit amet.</div> </div> <div> And I can´t seem to find a workaround to those "" and ''. Thanks in adv...

How to remove two lines from terminal output

Given that two lines have been printed out in the terminal, is it possible to delete both of them so they may be replaced with two new lines? I know you can use \r to replace 1 line (well, to move the cursor to the start of the line), but is there any way of doing this for the line above? As an example, I'm running a program for comput...

php script is ouputting php code, not sure why

I have a simple modal dialog that I developed on my own linux server, running php 5.3. The script (shown below) runs fine on my server. However, I moved it to my client's linux server and instead of echoing the text/html that it apparently is supposed to do, it echos ALL the actual php code from the > (greater than) character on. Does...

Using Android's build-in acoustic echo cancellation

Does anyone know how to use Android device's built-in acoustic echo cancellation? It is located somewhere in silicon and is used for GSM/CDMA speakerphone calls. We'd really like to tap into it for a VoIP application instead of rolling our own. Ben ...

PHP string cut short

Why does this code $string = "!@#$%^&*(<[email protected]"; echo $string; only output: !@#$%^&*( Is this is a PHP bug? ...

PHP strpos(), echoing instances found

Using the strpos() function in PHP, how can I echo what strpos() has found? All items that it has found. Thanks ...

PHP echo() MySQL result containing <> characters?

I am retrieving data from my SQL database... data exactly as it is in the DB = (21:48:26) <username> some text here. is it ok? when i try and echo $row['log']."<br>"; it displays it as = (21:48:26) some text here. is it ok? i assume this is due to the <> brackets making it think its an HTML opener... would this be the case? and if so...

PHP Print and Echo HTML

very simple question. Lol i am embarassed to ask this cause i am usually very good with php but what are the ways to display html inside of php? for example: <? if($flag): ?> <div>This will show is $flag is true </div> <? endif; ?> OR <? if($flag) echo '<div>This will show is $flag is true </div>'; ?> I know that ther...

php constants and EOT

is it possible to display constants php's EOT? for example: <? define('Hey', "HellO"); echo <<<EOT Hey EOT; ?> ...

How do I capture the result of an echo() into a variable in PHP?

I'm using a PHP library that echoes a result rather than returns it. Is there an easy way to capture the output from echo/print and store it in a variable? (Other text has already been output, and output buffering is not being used.) ...