Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php file_get_contents follow redirect

$context = stream_context_create(
    array(
        'http' => array(
            'follow_location' => true/false
        )
    )
);

$html = file_get_contents('http://www.example.com/', false, $context);

var_dump($http_response_header);
Comment

file_get_contents follow redirect

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$a = curl_exec($ch);
if(preg_match('#Location: (.*)#', $a, $r))
 $l = trim($r[1]);
Comment

PREVIOUS NEXT
Code Example
Php :: php check method of http request 
Php :: remove first letter php 
Php :: the_post_thumbnail add class 
Php :: laravel 6 link storage with public 
Php :: How to check even or odd number in php 
Php :: a2dismod 
Php :: laravel firstorfail 
Php :: how to make validate error when password doesnt match with password confirm laravel 
Php :: how console log laravel 
Php :: debug graphql wordpress 
Php :: strtoupper in php 
Php :: php curl timeout 
Php :: serve php file 
Php :: php unset session variable 
Php :: php how to get am pm from a datetime 
Php :: wordpress get post thumbnail url 
Php :: laravel blade uppercase 
Php :: open php.ini in ubuntu 
Php :: php get array average 
Php :: php code to convert to small letter 
Php :: get first key of array php 
Php :: php reset array keys 
Php :: php array start with index 0 
Php :: foreign key in laravel migration 
Php :: php script to generate random date 
Php :: Add [nom] to fillable property to allow mass assignment 
Php :: how to check history of database in phpmyadmin 
Php :: htaccess set php memory limit 
Php :: for loop php 
Php :: var_dump beautify 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =