Jump to content

The requested action with this object has failed.


Recommended Posts

I always get the same error:

Quote

The requested action with this object has failed.

code:

$oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
    $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
    $oHTTP.Open("POST", $url, False)
    $oHTTP.SetRequestHeader("User-Agent", $userAgent) ;; // "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 4.0.20506)"
    $oHTTP.SetRequestHeader("Referrer", "http://www.yahoo.com")
    $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
    $oHTTP.Send($data)
    $oReceived = $oHTTP.ResponseText
    Return $oReceived

 

 

Edited by SoyArcano
Link to comment
Share on other sites

  • Moderators

You have absolutely no error checking, so can't even define where the issue is as written. Try something like this:

$oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
    If IsObj($oHTTP) Then
        $oHTTP.Open("POST", $url, False)
            If @error Then
                ;MsgBox or ConsoleWrite letting you know there was an issue.
            Else
                $oHTTP.SetRequestHeader("User-Agent", $userAgent) ;; // "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 4.0.20506)"
            ;...etc,etc,etc

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

1 hour ago, JLogan3o13 said:

You have absolutely no error checking, so can't even define where the issue is as written. Try something like this:

$oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
    If IsObj($oHTTP) Then
        $oHTTP.Open("POST", $url, False)
            If @error Then
                ;MsgBox or ConsoleWrite letting you know there was an issue.
            Else
                $oHTTP.SetRequestHeader("User-Agent", $userAgent) ;; // "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 4.0.20506)"
            ;...etc,etc,etc

 

The error is in the line:

$oHTTP.Open("POST", $url, False)

 

And show me:

$oHTTP^Error

 

Edited by SoyArcano
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...