[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

first program help



Hello group,

I am attempting to get my first http program running without success.

Here is the web site php script I am trying to get to with the parameters
shown 

http://www.valuesms.com/log.php?u=Username&p=Password 

if I go there from a web browser I expect to get a response of "400 Bad
Request (login error)" which is what happens

However when I go there with the program below, I get a response of "400 Bad
Request (incomplete data)" which I what I would get if I went to the web
page with no parameters i.e. http://www.valuesms.com/log.php 

To me, this indicates that the parameters are not getting from my program to
the php script on the web site, although I do see them in the debug output.

Below is my program & the debug output.

The program is basically a copy of EXAMPLE2

Hope someone can see the error & help me out.

Regards

Anthony


Program

     H DFTACTGRP(*NO) ACTGRP(*NEW) BNDDIR('HTTPAPI')


     D/copy qrpglesrc,httpapi_h

     D cmd             pr                  extpgm('QCMDEXC')
     D  command                     200A   const
     D  length                       15P 5 const

     D CRLF            C                   CONST(x'0D25')
     D rc              s             10I 0
     D msg             s             52A

     D Enc             s                   like(HTTP_URL_ENCODER)
     D myPointer       s               *
     D dataSize        s             10I 0


     C                   eval      Enc = http_url_encoder_new

     c                   callp     http_url_encoder_addvar_s( Enc
     c                                                      : 'u'
     c                                                      : 'UserName')

     c                   callp     http_url_encoder_addvar_s( Enc
     c                                                      : 'p'
     c                                                      : 'Password')

     c                   callp     http_url_encoder_getptr( Enc
     c                                                    : myPointer
     c                                                    : dataSize )


     c                   callp     http_debug(*ON)

     c                   eval      rc = http_url_post(
     c                              'http://www.valuesms.com/log.php'
     c                             : myPointer
     c                             : dataSize
     c                             : '/tmp/testpost.html' )

     c                   if        rc = 302
     c                   eval      rc = http_url_get( http_redir_loc()
     c                                          : '/tmp/testpost.html')
     c                   endif

     c                   if        rc <> 1
     c                   eval      msg = http_error
     c                   dsply                   msg
     c                   else
     c                   callp     cmd('DSPF ''/tmp/testpost.html''': 200)
     c                   endif

     c                   callp     http_url_encoder_free(Enc)

     c                   eval      *inlr = *on                       




Debug

HTTPAPI Ver 1.20 released 2007-06-04

http_url_post(): entered
http_persist_open(): entered
http_long_ParseURL(): entered
http_persist_post(): entered
http_long_ParseURL(): entered
do_post(): entered
POST /log.php HTTP/1.1
Host: www.valuesms.com
User-Agent: http-api/1.20
Content-Type: text/xml
Expect: 100-continue
Content-Length: 21


recvresp(): entered
HTTP/1.1 100 Continue


SetError() #13: HTTP/1.1 100 Continue
senddoc(): entered
u=UserName&p=Password

recvresp(): entered
HTTP/1.1 400 Bad Request
Date: Wed, 13 Aug 2008 02:04:55 GMT
Server: Apache/2.2.8 (Fedora)
X-Powered-By: PHP/5.2.6
Status: 400 Bad Request
Content-Length: 34
Connection: close
Content-Type: text/html; charset=UTF-8


SetError() #13: HTTP/1.1 400 Bad Request
recvdoc parms: identity 34
header_load_cookies() entered
recvdoc(): entered
SetError() #0:
400 Bad Request (incomplete data)

SetError() #13: HTTP/1.1 400 Bad Request
http_close(): entered







<hr><span style="font-size: 7.5pt; font-family: Verdana,sans-serif; color: #587AB4">Any email (including all attachments) from Welding Industries Limited (ABN 18 004 547 111) is intended solely for its intended addressee(s). 
It may be confidential and/or subject to legal, professional or other privilege. Any confidentiality or privilege is not waived or lost because an email has been sent to you by mistake. 
If you are not the intended recipient, or the person responsible for delivering to the intended recipient, please be advised that you have received this email in error and that any use, retransmission, dissemination or copying is strictly prohibited. 
If you have received the email in error, please delete the material from any computer and notify the sender. 
All Welding Industries Limited emails are subject to copyright. No part of any email should be reproduced, adapted or communicated without the written consent of Welding Industries Limited as copyright owner. 
Any personal information received by you in an email from Welding Industries Limited must be handled in accordance with the Privacy Act 1988 (Cth). Welding Industries Limited accepts no responsibility for emails sent by employees which are of a personal nature or in breach of the law. 
</span><hr>

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------