Search
 
SCRIPT & CODE EXAMPLE
 

PHP

get http code curl php

$info = curl_getinfo($ch, CURLINFO_HTTP_CODE);
		
curl_close($ch);
if ($info == 200){
  return json_decode($result);
}
Comment

php curl example

$ch = curl_init();
$curlConfig = array(
    CURLOPT_URL            => "http://www.example.com/yourscript.php",
    CURLOPT_POST           => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POSTFIELDS     => array(
        'field1' => 'some date',
        'field2' => 'some other data',
    )
);
curl_setopt_array($ch, $curlConfig);
$result = curl_exec($ch);
curl_close($ch);

// result sent by the remote server is in $result
Comment

PHP cURL request

function &web_curl_http($url) 
{  
   $c = curl_init();
   curl_setopt( $c , CURLOPT_URL , $url);
   curl_setopt( $c , CURLOPT_USERAGENT, "Mozilla/5.0 (Linux Centos 7;) Chrome/74.0.3729.169 Safari/537.36");
   curl_setopt( $c , CURLOPT_RETURNTRANSFER, true);
   curl_setopt( $c , CURLOPT_SSL_VERIFYPEER, false);
   curl_setopt( $c , CURLOPT_SSL_VERIFYHOST, false);
   curl_setopt( $c , CURLOPT_TIMEOUT, 10000); // 10 sec
   $data = curl_exec($c);
   curl_close($c);
   return $data;
}
Comment

php curl request

$ch = curl_init();
$curlConfig = array(
    CURLOPT_URL            => "http://www.example.com/yourscript.php",
    CURLOPT_POST           => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POSTFIELDS     => array(
        'field1' => 'some date',
        'field2' => 'some other data',
    )
);
curl_setopt_array($ch, $curlConfig);
$result = curl_exec($ch);
curl_close($ch);
Comment

get curl httcode php

$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
Comment

PREVIOUS NEXT
Code Example
Php :: update query wordpress 
Php :: how to add dummy records using factory in laravel 8 
Php :: Git delete single branch 
Php :: laravel dynamic page title 
Php :: centos excecutable php 
Php :: larvel check two password 
Php :: php remove item array 
Php :: for i php 
Php :: tcpdf error unable to create output file in php 
Php :: php write file 
Php :: laravel session add array 
Php :: php get domain name with https 
Php :: php artisan services 
Php :: laravel eloquent randomise data from database 
Php :: laravel api csrf token disable 
Php :: blade template vs php core 
Php :: array filter use key 
Php :: select tag in laravel collective 
Php :: wordpress get text of wordpress post 
Php :: php function to convert string to camelcase 
Php :: laravel select all except some columns 
Php :: php store log in a text file 
Php :: group in route in laravel 
Php :: laravel websockets onclose 
Php :: php elseif 
Php :: inner join codeigniter 
Php :: remove first character from string laravel 
Php :: php string only letters 
Php :: rename migration in laravel 
Php :: laravel display error message 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =