Adam
Adam

Reputation: 20882

php + http_post_data

Is there a way to check if this is installed? Maybe something in phpinfo()?

I'm doing the call below and I don't get any reply at all. The page just ends when it gets to it.

        $postdata = array(
            'validation' => '1'
        );


        $response = http_post_data('../ajax/index_ajax_general.php', $postdata);
        print $response;

Upvotes: 3

Views: 6869

Answers (2)

drew010
drew010

Reputation: 69957

You could use

if (extension_loaded('pecl_http') == false) {
    // do not have extension
}

// or

if (function_exists('http_post_data') == false) {
    // function not available
}

Given that function is a PECL extension, you will probably find most PHP installations do not have these functions available.

Upvotes: 6

CodeZombie
CodeZombie

Reputation: 5377

As far as I can see from the documentation this function requires at least PHP v5.0: http://www.php.net/manual/en/http.requirements.php

If you don't get an error like "undefined function ..." the function is available and something with your code is wrong...

Upvotes: 0

Related Questions