dump:';
var_dump( $prod );
function Send2Api($url,$data)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
//curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$query = http_build_query($data);
curl_setopt($ch, CURLOPT_URL, "$url?$query");
echo "$url?$query";
$output = curl_exec($ch);
$info = curl_getinfo($ch);
$errno = curl_errno($ch);
$error = curl_error($ch);
var_dump($info);
var_dump($error);
if( $output === false || $errno != 0 ) {
} else if($info['http_code'] != 200) {
return json_encode(array($info,$errno,$error));
// Got a non-200 error code.
// Do more error checking
}
curl_close($ch);
return $output ;
}
?>
This one works perfectly well on localhost
Обсуждают сегодня