Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to display the responce of curl in php

$response = get_web_page("http://socialmention.com/search?q=iphone+apps&f=json&t=microblogs&lang=fr");
$resArr = array();
$resArr = json_decode($response);
echo "<pre>"; print_r($resArr); echo "</pre>";

function get_web_page($url) {
    $options = array(
        CURLOPT_RETURNTRANSFER => true,   // return web page
        CURLOPT_HEADER         => false,  // don't return headers
        CURLOPT_FOLLOWLOCATION => true,   // follow redirects
        CURLOPT_MAXREDIRS      => 10,     // stop after 10 redirects
        CURLOPT_ENCODING       => "",     // handle compressed
        CURLOPT_USERAGENT      => "test", // name of client
        CURLOPT_AUTOREFERER    => true,   // set referrer on redirect
        CURLOPT_CONNECTTIMEOUT => 120,    // time-out on connect
        CURLOPT_TIMEOUT        => 120,    // time-out on response
    ); 

    $ch = curl_init($url);
    curl_setopt_array($ch, $options);

    $content  = curl_exec($ch);

    curl_close($ch);

    return $content;
}
Comment

PREVIOUS NEXT
Code Example
Php :: php open csv 
Php :: how to get auth user name in laravel 
Php :: how to show validation error in laravel 8 
Php :: laravel model create array 
Php :: getting last day of next month in php 
Php :: php delete array element 
Php :: laravel migrate seed 
Php :: random number laravel faker 
Php :: add to collection laravel 
Php :: Format and show date PHP 
Php :: create foreign key phpmyadmin 
Php :: php round() function 
Php :: php artisan storage link cpanel 
Php :: make model with migration laravel 
Php :: return last inserted id in laravel 
Php :: php add to array in loop 
Php :: php number_format 
Php :: how to replace double quotes in a string in php 
Php :: refresh a specific migration laravel 
Php :: laravel check if model relation exists 
Php :: laravel hasmany count 
Php :: create form request laravel 
Php :: permissions for laravel deployment 
Php :: php get current month first date 
Php :: add 1 day php datetime 
Php :: wordpress is home page 
Php :: symfony datetime now 
Php :: php get first element of array 
Php :: lumen file upload 
Php :: db raw update laravel 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =