forms-3rdparty-integration icon indicating copy to clipboard operation
forms-3rdparty-integration copied to clipboard

Post returns success but body is empty. what am i missing please?

Open wecodelaravel opened this issue 6 years ago • 1 comments

Here are my sections

Json Template

{
"customername": "[name]"
"email": "[email]"
"phone": "[phone]"
"family_number": "[family_number]"
"how_long": "[how_long]"
"requested_date": "[requested_date]"
"requested_time": "[requested_time]"
"requested_clinic": "[requested_clinic]"
"clinic_id": "[clinic_id]"
"clinic_email": "[clinic_email]"
"clinic_address": "[clinic_address]"
"clinic_phone": "[clinic_phone]"
"clinic_text_numbers": "[clinic_text_numbers]"
"client_firstname": "[client_firstname]"
"submitted_user_city":"[submitted_user_city]"
"submitted_user_state":"[submitted_user_state]"
"country":"[country]"
"latitude":"[latitude]"
"longitude":"[longitude]"
"searched_for":"[searched_for]"
"submitted":"[submitted]"
}

Params:

Array
(
    [customername] => test test
    [email] => [email protected]
    [phone] => 555 555 5555
    [family_number] => 1
    [how_long] => between 1-3 months
    [requested_date] => 2018-05-01
    [requested_time] => 4PM-8PM
    [requested_clinic] => Heartland Healthy Heads - Olathe
    [clinic_id] => 5207
    [clinic_email] => [email protected]
    [clinic_address] => 80 test address
    [clinic_phone] => 555 555 5555
    [clinic_text_numbers] =>[email protected]
    [client_firstname] => test
    [submitted_user_city] => United States
    [submitted_user_state] => CA
    [country] => United States
    [latitude] => 37.751
    [longitude] => -97.822
    [searched_for] => 
    [submitted] => 2018-05-01 20:38:35
)

Remote server result:

Array
(
    [headers] => Requests_Utility_CaseInsensitiveDictionary Object
        (
            [data:protected] => Array
                (
                    [date] => Tue, 01 May 2018 20:39:39 GMT
                    [server] => Apache
                    [cache-control] => no-cache, private
                    [x-ratelimit-limit] => 60
                    [x-ratelimit-remaining] => 58
                    [access-control-allow-origin] => *
                    [access-control-allow-headers] => Content-Type
                    [access-control-allow-methods] => GET,POST,OPTIONS,DELETE,PUT
                    [content-type] => application/json
                )
        )
    [body] => []
    [response] => Array
        (
            [code] => 200
            [message] => OK
        )
    [cookies] => Array
        (
        )
    [filename] => 
    [http_response] => WP_HTTP_Requests_Response Object
        (
            [response:protected] => Requests_Response Object
                (
                    [body] => []
                    [raw] => HTTP/1.1 200 OK
Date: Tue, 01 May 2018 20:39:39 GMT
Server: Apache
Cache-Control: no-cache, private
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Content-Type
Access-Control-Allow-Methods: GET,POST,OPTIONS,DELETE,PUT
Connection: close
Transfer-Encoding: chunked
Content-Type: application/json
[]
                    [headers] => Requests_Response_Headers Object
                        (
                            [data:protected] => Array
                                (
                                    [date] => Array
                                        (
                                            [0] => Tue, 01 May 2018 20:39:39 GMT
                                        )
                                    [server] => Array
                                        (
                                            [0] => Apache
                                        )
                                    [cache-control] => Array
                                        (
                                            [0] => no-cache, private
                                        )
                                    [x-ratelimit-limit] => Array
                                        (
                                            [0] => 60
                                        )
                                    [x-ratelimit-remaining] => Array
                                        (
                                            [0] => 58
                                        )
                                    [access-control-allow-origin] => Array
                                        (
                                            [0] => *
                                        )
                                    [access-control-allow-headers] => Array
                                        (
                                            [0] => Content-Type
                                        )
                                    [access-control-allow-methods] => Array
                                        (
                                            [0] => GET,POST,OPTIONS,DELETE,PUT
                                        )
                                    [content-type] => Array
                                        (
                                            [0] => application/json
                                        )
                                )
                        )
                    [status_code] => 200
                    [protocol_version] => 1.1
                    [success] => 1
                    [redirects] => 1
                    [url] => https://www.PRIVATE-ASK-ME.com/api/v1/bookings
                    [history] => Array
                        (
                            [0] => Requests_Response Object
                                (
                                    [body] => <!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="refresh" content="0;url=https://www.PRIVATE-ASK-ME.com/api/v1/bookings" />
        <title>Redirecting to https://www.PRIVATE-ASK-ME.com/api/v1/bookings</title>
    </head>
    <body>
        Redirecting to <a href="https://www.PRIVATE-ASK-ME.com/api/v1/bookings">https://www.PRIVATE-ASK-ME.com/api/v1/bookings</a>.
    </body>
</html>
                                    [raw] => HTTP/1.1 302 Found
Date: Tue, 01 May 2018 20:39:38 GMT
Server: Apache
Cache-Control: no-cache, private
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
Location: https://www.PRIVATE-ASK-ME.com/api/v1/bookings
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Content-Type
Access-Control-Allow-Methods: GET,POST,OPTIONS,DELETE,PUT
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="refresh" content="0;url=https://www.PRIVATE-ASK-ME.com/api/v1/bookings" />
        <title>Redirecting to https://www.PRIVATE-ASK-ME.com/api/v1/bookings</title>
    </head>
    <body>
        Redirecting to <a href="https://www.PRIVATE-ASK-ME.com/api/v1/bookings">https://www.PRIVATE-ASK-ME.com/api/v1/bookings</a>.
    </body>
</html>
                                    [headers] => Requests_Response_Headers Object
                                        (
                                            [data:protected] => Array
                                                (
                                                    [date] => Array
                                                        (
                                                            [0] => Tue, 01 May 2018 20:39:38 GMT
                                                        )
                                                    [server] => Array
                                                        (
                                                            [0] => Apache
                                                        )
                                                    [cache-control] => Array
                                                        (
                                                            [0] => no-cache, private
                                                        )
                                                    [x-ratelimit-limit] => Array
                                                        (
                                                            [0] => 60
                                                        )
                                                    [x-ratelimit-remaining] => Array
                                                        (
                                                            [0] => 59
                                                        )
                                                    [location] => Array
                                                        (
                                                            [0] => https://www.PRIVATE-ASK-ME.com/api/v1/bookings
                                                        )
                                                    [access-control-allow-origin] => Array
                                                        (
                                                            [0] => *
                                                        )
                                                    [access-control-allow-headers] => Array
                                                        (
                                                            [0] => Content-Type
                                                        )
                                                    [access-control-allow-methods] => Array
                                                        (
                                                            [0] => GET,POST,OPTIONS,DELETE,PUT
                                                        )
                                                    [content-type] => Array
                                                        (
                                                            [0] => text/html; charset=UTF-8
                                                        )
                                                )
                                        )
                                    [status_code] => 302
                                    [protocol_version] => 1.1
                                    [success] => 
                                    [redirects] => 0
                                    [url] => https://www.PRIVATE-ASK-ME.com/api/v1/bookings
                                    [history] => Array
                                        (
                                        )
                                    [cookies] => Requests_Cookie_Jar Object
                                        (
                                            [cookies:protected] => Array
                                                (
                                                )
                                        )
                                )
                        )
                    [cookies] => Requests_Cookie_Jar Object
                        (
                            [cookies:protected] => Array
                                (
                                )
                        )
                )
            [filename:protected] => 
            [data] => 
            [headers] => 
            [status] => 
        )
)

Error logs:

Array
(
    [0] => WP_Error Object
        (
            [errors] => Array
                (
                    [json-error] => Array
                        (
                            [0] => 4
                        )
                )
            [error_data] => Array
                (
                )
        )
)

If you look you will see the body {] is empty. not sure how to fix this. Any help would be greatly appreciated.

Thanks if advance.

wecodelaravel avatar May 02 '18 05:05 wecodelaravel

Please post the full debug, as we don't know what you sent. And without knowing where you're sending it, we have no way of knowing what's required. Maybe an empty response is okay? If that's the case, specifying an expected response will make the plugin treat the empty result as a failure.

zaus avatar May 11 '18 18:05 zaus