Eric
Eric

Reputation: 575

Workaround possible for cURL and Javascript?

Everything was going great in my previous help request thread. I was on the correct track to get around a CSRF, but needed to be pointed in the right direction. I received great help and even an alternate script used to log into Google's Android Market. Both my script and the one I altered to match my form is get hung up at the same point. Apparently cURL cannot process JS, is there any way to work around the form being submitted with submitForm() without changing the form?

Here is the code for the SubmitForm function

function submitForm(formObj, formMode) {
    if (!formObj)
        return false;
    if (formObj.tagName != "FORM") {
        if (!formObj.form)
            return false;
        formObj = formObj.form;
    }
    if (formObj.mode)
        formObj.mode.value = formMode;
    formObj.submit();
}

Here is the code for the submit button -

<a class="VertMenuItems" href="javascript: document.authform.submit();">Submit</a>

Here is a link to my last question in case more background information is needed.

Upvotes: 0

Views: 1190

Answers (1)

user420095
user420095

Reputation:

PHP service...

<?php
// PHP service file

// Get all data coming in via GET or POST
$vars = $_GET + $_POST;

// Do something with the data coming in
?>

Javascript elsewhere...

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        function sendData(data)
        {
            var response;
            $.ajax({
                url: 'phpservice.php',
                data: data,
                type: 'POST',
                dataType: 'json',
                async: false,
                success: function(response_from_service)
                {
                    response = response_from_service;
                },
                error: function()
                {
                }
            });
            return response;
        };
        function getData(data)
        {
            var response;
            $.ajax({
                url: 'phpservice.php',
                data: data,
                type: 'GET',
                dataType: 'json',
                async: false,
                success: function(response_from_service)
                {
                    response = response_from_service;
                },
                error: function()
                {
                }
            });
            return response;
        };
    });
</script>

Upvotes: 1

Related Questions