dimanche 22 décembre 2019

How to return function in the curl

I have to call an API function in the curl , but i didn't getting the response.Please help me if anyone know the correct method.

Here is my curl function:

function get_result($url=''){
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
    curl_setopt($ch, CURLOPT_TIMEOUT, 5);
    $data = curl_exec($ch);
    echo $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
    return $this->hangup_api();
}

hangup_api() is my function and it doesn't returning to that function.

Thank You



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire