Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php curl empty response

// Use this example to get the error message if there is one, the
//  result will often be empty if there is an error so it must be handled
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_PROXY, $proxy); // $proxy is ip of proxy server
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);

$httpCode = curl_getinfo($ch , CURLINFO_HTTP_CODE); // this results 0 every time
$response = curl_exec($ch);

if ($response === false) 
    $response = curl_error($ch);

echo stripslashes($response);

curl_close($ch);
Comment

PREVIOUS NEXT
Code Example
Php :: php apply function to array elements 
Php :: json_encode alternative 
Php :: minishlink/web-push v5.2.5 requires ext-gmp * 
Php :: laravel outer join 
Php :: laravel 8 add column to existing table 
Php :: python to php 
Php :: worpdress pods taxonomy get custom field 
Php :: laravel intersect 
Php :: add object in array php 
Php :: wordpress autoload composer 
Php :: integrate fontawesome in blade laravel 
Php :: Advanced Custom Fields get sub field image 
Php :: Multiple image upload with CodeIgniter 
Php :: symfony form get errors 
Php :: laravel ecommerce 
Php :: php strpos 
Php :: get git branch by php 
Php :: route() and with() in laravel 
Php :: laravel use controller function in another controller 
Php :: Create Mysqli Table Using Php 
Php :: set_magic_quotes_runtime php 7 
Php :: Laravel Migration - Update Enum Options 
Php :: How to Customize WooCommerce Breadcrumb 
Php :: acf wordpress loop through and display blog posts order by date and type 
Php :: laravel copy data 
Php :: php replace string 
Php :: laravel 9 excel 
Php :: signup api in laravel 
Php :: arc cosine php 
Php :: How do i multiple variables in php 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =