How sets IWinHttpRequest::Option property?

Moderator: Rathinagiri

Post Reply
huiyi_ch
Posts: 83
Joined: Sat May 21, 2016 5:27 am
Has thanked: 1 time
Been thanked: 9 times

How sets IWinHttpRequest::Option property?

Post by huiyi_ch » Tue Mar 20, 2018 2:03 pm

Hello,
Why this program is not compiled, always prompt: invalid lvalue ':

Code: Select all

 
#include <hmg.ch>
Function Main
local WinHtt:=Win_OleCreateObject( "WinHttp.WinHttpRequest.5.1")
WinHtt:open("POST","http://www.hmgforum.com/ucp.php?mode=login")
MSGDEBUG(WinHtt:Option(4))
MSGDEBUG(WinHtt:OPTION(6))
WinHtt:OPTION(6)=.F.
Return   

Please help me!
Thanks
Attachments
error_info.jpg
error information
error_info.jpg (50.35 KiB) Viewed 658 times

User avatar
mol
Posts: 3062
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 176 times
Been thanked: 96 times
Contact:

Post by mol » Tue Mar 20, 2018 3:25 pm

Option is a method, so you can not assign value to it

User avatar
serge_girard
Posts: 2139
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 449 times
Been thanked: 102 times
Contact:

Post by serge_girard » Tue Mar 20, 2018 3:37 pm

Hi,

I see an assignment to option on this site:

http://www.808.dk/?code-simplewinhttprequest

But I cannot get it working!

Serge

edk
Posts: 361
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 102 times
Been thanked: 262 times

Post by edk » Tue Mar 20, 2018 5:28 pm

huiyi_ch wrote:
Tue Mar 20, 2018 2:03 pm
Hello,
Why this program is not compiled, always prompt: invalid lvalue ':

Code: Select all

 
#include <hmg.ch>
Function Main
local WinHtt:=Win_OleCreateObject( "WinHttp.WinHttpRequest.5.1")
WinHtt:open("POST","http://www.hmgforum.com/ucp.php?mode=login")
MSGDEBUG(WinHtt:Option(4))
MSGDEBUG(WinHtt:OPTION(6))
WinHtt:OPTION(6)=.F.
Return   

Please help me!
Thanks
In this case (setting the property with the argument) you should, instead of

Code: Select all

WinHtt:OPTION(6)=.F.
try to use

Code: Select all

WinHtt:_Option( 6, .F. )
As Marek noted, the compiler expects a method that can not be assigned a value.
Therefore, for such properties, you need to change some syntax, precede the name of the property with an underscore and add the last argument: the value that we assign to the property.

Edward.

huiyi_ch
Posts: 83
Joined: Sat May 21, 2016 5:27 am
Has thanked: 1 time
Been thanked: 9 times

Post by huiyi_ch » Tue Mar 20, 2018 8:33 pm

Thank you very much Edward!
Thanks folks!

edk
Posts: 361
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 102 times
Been thanked: 262 times

Post by edk » Tue Mar 20, 2018 9:37 pm

慧怡你好。
在我看来,你正在做一些有趣的事情,我希望你会与我们分享你的工作成果。

huiyi_ch
Posts: 83
Joined: Sat May 21, 2016 5:27 am
Has thanked: 1 time
Been thanked: 9 times

Post by huiyi_ch » Tue Mar 20, 2018 10:12 pm

Edward老师,您好:
首先,非常感谢您给予我及时的帮助!我认为您是一位天才!是的,我正在用HMG做一个网页爬虫程序。我会与大家分享我的经验。谢谢!

Post Reply