session_start() and session_destroy() functions

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
icode
New php-forum User
New php-forum User
Posts: 3
Joined: Thu Feb 11, 2021 1:13 am

Mon Mar 08, 2021 12:56 am

Hey all,

Was trying to understand the concepts behind PHP programming. Was behind cURL trying to connect a URL. Just curious and wanted to understand if this how it's done. Ref - https://www.interviewbit.com/php-interview-questions/

Code: Select all

//Step 1 To initialize curl
     $ch = curl_init();
//Step 2 To set url where you want to post
     $url = ‘http://www.localhost.com’;
//Step 3 Set curl functions which are needs to you
     curl_setopt($ch,CURLOPT_URL,$url);
     curl_setopt($ch,CURLOPT_POST,true);
     curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
     curl_setopt($ch,CURLOPT_POSTFIELD,’postv1 = value1&postv2 = value2’);
//Step 4 To execute the curl
     $result = curl_exec($ch);
//Step 5 Close curl
     curl_close($ch);
Post Reply