Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php curl detect 404

$handle = curl_init($url);
curl_setopt($handle,  CURLOPT_RETURNTRANSFER, TRUE);

/* Get the HTML or whatever is linked in $url. */
$response = curl_exec($handle);

/* Check for 404 (file not found). */
$httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
if($httpCode == 404) {
    /* Handle 404 here. */
}

curl_close($handle);

/* Handle $response here. */
Comment

php curl detect 404

$handle = curl_init($url);
curl_setopt($handle,  CURLOPT_RETURNTRANSFER, TRUE);

/* Get the HTML or whatever is linked in $url. */
$response = curl_exec($handle);

/* Check for 404 (file not found). */
$httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
if($httpCode == 404) {
    /* Handle 404 here. */
}

curl_close($handle);

/* Handle $response here. */
Comment

PREVIOUS NEXT
Code Example
Php :: php access key stdClass object 
Php :: php conditionals 
Php :: insert into laravel 8 
Php :: enable extensions in php.ini 
Php :: nested with laravel 
Php :: laravel copy data 
Php :: PHP MySQL Insert Multiple Records 
Php :: php json_encode float 
Php :: laravel collection to json 
Php :: php extract number from string without comma 
Php :: import data from csv to db php 
Php :: fillable vs guarded laravel 
Php :: php preg replace 
Php :: -store() laravel change name 
Php :: bootstrap is not defined in laravel 
Php :: laravel eloquent get all where in 
Php :: database, counts 
Php :: laravel get namespace 
Php :: how to know if file is empty in php 
Php :: encryption and decryption in php example 
Php :: wordpress post add input field 
Php :: laravel get from model 
Php :: cakephp login session 
Php :: Get data from array (from an API) in Laravel 
Php :: laravel public static variable 
Php :: wp_schedule_event 
Php :: PHP stripcslashes — Un-quote string quoted with addcslashes() 
Php :: Eager realationship in laravel 
Php :: Uncaught jquery-numerator requires jQuery to be loaded first wordpress 
Php :: php fake stripe client 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =