PHP Curl Load Simple Webpage - Supercoders | Web Development and Design | Tutorial for Java, PHP, HTML, Javascript PHP Curl Load Simple Webpage - Supercoders | Web Development and Design | Tutorial for Java, PHP, HTML, Javascript

Post Top Ad

Post Top Ad

Thursday, February 1, 2018

sUPERCODER%2BLOGO

PHP Curl Load Simple Webpage

PHP Curl Load Simple Webpage

phpcurl

Code : - 

<?php
$url="https://jsonplaceholder.typicode.com/posts";
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE);
$html=curl_exec($ch);
echo $html;
?>

In 2nd line we define our webpage which we have to fetch.
Then in 3rd line we initialize our curl.
In 4th line we set option for curl like url and return transfer etc.
Then we execute our curl and fetch the webpage.

Video Tutorial

1 comment:

  1. blogger_logo_round_35

    This blog aware me about different programs which can become very useful for our friends and kids. Few websites provide combined courses and few of the are separately for single subject. Glad to get this information.
    https://www.mtoag.com/custom-php-programmer.htm

    ReplyDelete

Post Top Ad