[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: first program help
Thanks Scott, that worked a treat.
The documentation for the site says that it accepts either GET or POST, but
it appears that may not be so.
Anyway, problem solved, I can now finish my iSeries to SMS program. yay
:)
-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Wednesday, 13 August 2008 2:59 PM
To: HTTPAPI and FTPAPI Projects
Subject: Re: first program help
Hello,
It would appear that the web site is expecting a GET request with
parameters encoded into the URL, but you are sending a POST request with
the parameters included in the POST data upload.
Try changing your HTTP_url_post() to HTTP_url_get() instead. So the
code reads more like this:
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 eval URL = 'http://www.valuesms.com/log.php?'
c + http_url_encoder_getstr(Enc)
c callp http_debug(*ON)
c eval rc = http_url_get( URL
C : '/tmp/testpost.html')
Just make the 'URL' field a large VARYING field... maybe "1024A VARYING"
or something like that.
Good luck
A. M. [Tony] Cusack wrote:
> 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
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
<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
-----------------------------------------------------------------------