Re: [PHP] Can't fetch HTTP POST data in PHP?

2003-11-17 Thread Ivan Marenic
Hi, Kim.

Your example is good but you missed the point here. Chris knows exactly
where my problem is.

Sending HTTP POST from mobile device is a bit different than using classic
web client. It shouldnt be, but it is.

Data is going trough WAP gateways, mobile operators proxeis ...

Worst case scenario is that some header items can be generated by
application, some by the phone's runtime, and others by the WAP gateway.

And those reaching the server might not be what we expect.

Regards,
Ivan







"Kim Steinhaug" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I dont see the problem here at all, here is my test :
> CutNpaste into your own environment ans save as .php file .
>
> All I did was remove the php_info() so that variables dont get
> messed up (apparently), and removed the error_reporting.
>
> Result gives this :
> array(3) { ["username"]=> string(3) "123" ["email"]=> string(3) "123"
> ["submit"]=> string(10) "Submit me!" }
>
> -
> 
> 
> 
>  Untitled
> 
> 
>  //error_reporting(E_ALL);
> echo "\n";
> //phpinfo();
> echo "\n";
> var_dump($_POST);
> ?>
> 
> Your name: 
> Email: 
> 
> 
> 
> 
> --
>
> -- 
> Kim Steinhaug
> ---
> There are 10 types of people when it comes to binary numbers:
> those who understand them, and those who don't.
> ---
>
>
> "David T-G" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Can't fetch HTTP POST data in PHP?

2003-11-16 Thread Ivan Marenic
Solved all my problems with PERL.

Cheers.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Can't fetch HTTP POST data in PHP?

2003-11-15 Thread Ivan Marenic
I did not omit content.
Copied whole text box in sniffer using context menu comands (select all,
copy) - pasted to news agent.
There is no content.

However, when using local server, on my desktop, I assume there is content
because I am getting response from ASP page with exact data wich is sent
from client.
PHP page responses exactly the same as the one on remote Apache server.

I have mental fog in my mind write now.





"Chris Shiflett" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> --- Ivan Marenic <[EMAIL PROTECTED]> wrote:
> > Here is "failed" POST REQUEST to that server:
> > *
> > POST /http_post.php HTTP/1.1
> > User-Agent: Profile/MIDP-1.0 Configuration/CLDC-1.0
> > Host: www.milleniumtip.com:80
> > Content-Disposition: attachment; name="userfile";
> filename="userfile_txt"
> > Connection: close
> > Content-Type: text/plain
> > Content-Length: 47
> > Content-Language: en-US
> >
> > 
>
> That's the whole thing? If so, the problem seems to be a complete lack of
> content. The Content-Length header specifies that 47 bytes are coming, and
> Content-Type tells us that it is plain text, but there is nothing (it
> should be after the blank line that follows Content-Language). Can you
> check to see that you didn't omit this?
>
> Chris
>
> =
> Chris Shiflett - http://shiflett.org/
>
> PHP Security Handbook
>  Coming mid-2004
> HTTP Developer's Handbook
>  http://httphandbook.org/
> RAMP Training Courses
>  http://www.nyphp.org/ramp

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Can't fetch HTTP POST data in PHP?

2003-11-15 Thread Ivan Marenic
> Is it possible for you to show us the HTTP request that is failing? It is
> possible that it is malformed in some way that is fine with some Web
> servers and not with others.

That may be possible but I am testing ASP i PHP(4.3.2) on same server IIS
5.0, localy.
Can't sniff that (Network adapter not in use)

Other, remote server I am using is Apache on RedHat Linux.

Here is "failed" POST REQUEST to that server:
*
POST /http_post.php HTTP/1.1

User-Agent: Profile/MIDP-1.0 Configuration/CLDC-1.0

Host: www.milleniumtip.com:80

Content-Disposition: attachment; name="userfile"; filename="userfile_txt"

Connection: close

Content-Type: text/plain

Content-Length: 47

Content-Language: en-US



Here is response:


HTTP/1.1 200 OK

Date: Sat, 15 Nov 2003 22:02:40 GMT

Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) mod_watch/3.12
mod_throttle/3.1.2 mod_gzip/1.3.19.1a mod_auth_pam/1.0a mod_ssl/2.8.11
OpenSSL/0.9.6e PHP/4.2.3 mod_perl/1.26 FrontPage/5.0.2.2510

X-Powered-By: PHP/4.2.3

Connection: close

Transfer-Encoding: chunked

Content-Type: text/html




>
> You might be able to use ethereal (http://www.ethereal.com/) to get the
> HTTP request.


For sniffing HTTP traffic I am using EffeTech HTTP Sniffer. Works OK.

Ivan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Can't fetch HTTP POST data in PHP?

2003-11-15 Thread Ivan Marenic
> This looks you are expecting to receive a POST request with PHP. So, are
> you wanting to send one or receive one?

Receive one.


"Chris Shiflett" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> --- Ivan Marenic <[EMAIL PROTECTED]> wrote:
> > Here is j2me code snippet:
>
> I try to avoid all of the crap that begins with the letter J, but your
> example code looks like you are sending a POST request.
>
> > Here is PHP code snippet:
> >
> > // Show any post vars, but nothing shows - never!
> > if(count($_POST)>0){
> >  echo "POST".$new_line;
> >  print_r($_POST);
> >  echo $new_line;
> > }
>
> This looks you are expecting to receive a POST request with PHP. So, are
> you wanting to send one or receive one?
>
> Chris
>
> =
> Chris Shiflett - http://shiflett.org/
>
> PHP Security Handbook
>  Coming mid-2004
> HTTP Developer's Handbook
>  http://httphandbook.org/
> RAMP Training Courses
>  http://www.nyphp.org/ramp

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] ASP code that works!

2003-11-15 Thread Ivan Marenic
Dim binread
Dim bytecount
bytecount = Request.TotalBytes
binread = Request.BinaryRead(bytecount)

Response.BinaryWrite binread

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Can't fetch HTTP POST data in PHP?

2003-11-15 Thread Ivan Marenic
Here is ASP code that works.

Dim binread
Dim bytecount

bytecount = Request.TotalBytes
binread = Request.BinaryRead(bytecount)

'Send response back to client
Response.BinaryWrite binread

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Can't fetch HTTP POST data in PHP?

2003-11-15 Thread Ivan Marenic
Here is j2me code snippet:

byte[] postData="This is my test line! It works!
Yipi-Yai-Yee!!!".getBytes();

try{

c = (HttpConnection)Connector.open(url_post);
c.setRequestMethod(HttpConnection.POST);
c.setRequestProperty( "User-Agent", "Profile/MIDP-1.0
Configuration/CLDC-1.0" );
c.setRequestProperty( "Content-Language", "en-US" );
c.setRequestProperty( "Content-Type", "text/plain");
c.setRequestProperty( "Connection", "close");
c.setRequestProperty( "Content-Disposition","attachment;
name=\"userfile\"; filename=\"userfile_txt\"");
c.setRequestProperty( "Content-Length", Integer.toString(
postData.length ) );

os = c.openOutputStream();
os.write( postData );
os.close();
os = null;


Here is PHP code snippet:

//Here I see HTTP method, and response is POST
:
echo $_SERVER['REQUEST_METHOD'];
:

:
// Show any post vars, but nothing shows - never!
if(count($_POST)>0){
 echo "POST".$new_line;
 print_r($_POST);
 echo $new_line;
}
:

// try with upload files array
if(count($_FILES)>0){
 echo "FILES".$new_line;
 print_r($_FILES);
 echo $new_line;
}


That's it.

Greetings,
Ivan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Can't fetch HTTP POST data in PHP?

2003-11-15 Thread Ivan Marenic
Any idea why?

I am sending HTTP post request from j2me mobile device.

Request is OK because it works well on ASP page.

Thanks for help!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Write file can't work ?!? :-(

2002-11-17 Thread Ivan Marenic
It works. Thank you.

I can't belive I was so stupid, and obviously I was.

Thanks again! :-)



"Rija" <[EMAIL PROTECTED]> wrote in message
007c01c28e9b$f47c7f30$3d00a8c0@workelp3">news:007c01c28e9b$f47c7f30$3d00a8c0@workelp3...
> Try to change write permission doing like the following:
> - Right click on the folder
> - Select proprieties
> - Click on security icon
> - And allow everyone to write, read, execute
>
> If you cannot access this tools, ask your administrator to allow you to do
> this work.
>
>
> - Original Message -
> From: "Ivan Marenic" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, November 18, 2002 7:21 AM
> Subject: Re: [PHP] Write file can't work ?!? :-(
>
>
> > Here is IIS permisin setting. Watch attachment.
> >
> > Thanks for help!
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Write file can't work ?!? :-(

2002-11-17 Thread Ivan Marenic
I've tried same source on different OS and it works OK.

I assume there is a BUG, for win 2000.

Thank you all for help.
Kind regards, Ivan




"Jason Sheets" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Have you tried giving it an absolute path rather than a relative one?

Jason

On Sun, 2002-11-17 at 12:57, Ivan Marenic wrote:
> I've tried. It doesent work.
>
> PHP documentation for fopen function says following:
>
> Note: The mode may contain the letter 'b'. This is useful only on systems
> which differentiate between binary and text files (i.e. Windows. It's
> useless on Unix). If not needed, this will be ignored.
>
> I've tried all variations: "w", "r+", "wb" ... nothnig works.
>
>
>
> "Stephen" <[EMAIL PROTECTED]> wrote in message
> 000901c28e73$2f24a870$0200a8c0@melchior">news:000901c28e73$2f24a870$0200a8c0@melchior...
> > wb is not a permission. Try putting just w.
> >
> >
> > - Original Message -
> > From: "Ivan MareniƦ" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Sunday, November 17, 2002 2:47 PM
> > Subject: [PHP] Write file can't work ?!? :-(
> >
> >
> > > Hi.
> > >
> > > I am trying to create little counter:
> > > I can't open file for writing.
> > > I've tried different params: "w", "r+", "wb" ... nothnig works
> > >
> > > I am using IIS 5.0 , and I have set permitions to read & write files
on
> > > server.
> > >
> > >
> > > = source code ===
> > >
> > > if(is_writable("counter.txt")==TRUE)
> > >  echo "File is writable";
> > > else
> > >  echo "File is NOT writable";
> > >
> > > echo "";
> > >
> > > $fd = fopen ("counter.txt", "r");
> > > $my_count=0;
> > > while (!feof ($fd)) {
> > > $my_count = fgets($fd, 4096);
> > > }
> > > fclose ($fd);
> > >
> > > $fd = fopen ("counter.txt", "wb");
> > > if($fd==TRUE)
> > >  {
> > >  $my_count++;
> > >  fputs($fd, $my_count);
> > >  fclose ($fd);
> > >  }
> > >
> > > echo "Your are user no:";
> > > echo $my_count;
> > >
> > > = end source 
> > >
> > > but after execution PHP says that:
> > >
> > > File is writable
> > >
> > > Warning: fopen("counter.txt", "wb") - Permission denied in
> > > c:\inetpub\wwwroot\PSK\user_no.php on line 27
> > > Your are user no:8
> > >
> > > Whay can't I open file for writing???
> > >
> > > Thanks for help!!!
> > >
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Write file can't work ?!? :-(

2002-11-17 Thread Ivan Marenic
I've tried. It doesent work.

PHP documentation for fopen function says following:

Note: The mode may contain the letter 'b'. This is useful only on systems
which differentiate between binary and text files (i.e. Windows. It's
useless on Unix). If not needed, this will be ignored.

I've tried all variations: "w", "r+", "wb" ... nothnig works.



"Stephen" <[EMAIL PROTECTED]> wrote in message
000901c28e73$2f24a870$0200a8c0@melchior">news:000901c28e73$2f24a870$0200a8c0@melchior...
> wb is not a permission. Try putting just w.
>
>
> - Original Message -
> From: "Ivan MareniƦ" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Sunday, November 17, 2002 2:47 PM
> Subject: [PHP] Write file can't work ?!? :-(
>
>
> > Hi.
> >
> > I am trying to create little counter:
> > I can't open file for writing.
> > I've tried different params: "w", "r+", "wb" ... nothnig works
> >
> > I am using IIS 5.0 , and I have set permitions to read & write files on
> > server.
> >
> >
> > = source code ===
> >
> > if(is_writable("counter.txt")==TRUE)
> >  echo "File is writable";
> > else
> >  echo "File is NOT writable";
> >
> > echo "";
> >
> > $fd = fopen ("counter.txt", "r");
> > $my_count=0;
> > while (!feof ($fd)) {
> > $my_count = fgets($fd, 4096);
> > }
> > fclose ($fd);
> >
> > $fd = fopen ("counter.txt", "wb");
> > if($fd==TRUE)
> >  {
> >  $my_count++;
> >  fputs($fd, $my_count);
> >  fclose ($fd);
> >  }
> >
> > echo "Your are user no:";
> > echo $my_count;
> >
> > = end source 
> >
> > but after execution PHP says that:
> >
> > File is writable
> >
> > Warning: fopen("counter.txt", "wb") - Permission denied in
> > c:\inetpub\wwwroot\PSK\user_no.php on line 27
> > Your are user no:8
> >
> > Whay can't I open file for writing???
> >
> > Thanks for help!!!
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php