Php Curl



This is sample script to use curl, Just input curl_setopt,
exp :
curlsetop[0] > name : CURLOPT_URL ; value : https://amzn.to/3njlWW6
curlsetop[1] > name : CURLOPT_RETURNTRANSFER ; value : true
curlsetop[2] > name : CURLOPT_FOLLOWLOCATION ; value : true
You can add form input.
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
<html>
<head>
<title> New Document </title>
<meta name='Generator'>
<meta name='Author'>
<meta name='Keywords'>
<meta name='Description'>
</head>
<body>
<form method='post' action='>
<table>
<tr>
<td>curl_setopt [0]</td>
<td>Name : <input type='text' size='50' name='setopt_name[]'></td>
<td>Value :<input type='text' size='50' name='setopt_value[]'></td>
</tr>
<tr>
<td>curl_setopt [0]</td>
<td>Name : <input type='text' size='50' name='setopt_name[]'></td>
<td>Value :<input type='text' size='50' name='setopt_value[]'></td>
</tr>
<tr>
<td>curl_setopt [0]</td>
<td>Name : <input type='text' size='50' name='setopt_name[]'></td>
<td>Value :<input type='text' size='50' name='setopt_value[]'></td>
</tr>
<tr>
<td><input type='submit' name='submit_yes' value='EXECUTE'></td>
</tr>
</table>
</form>
<?php
function curl_test($setopt_content)
{
$ch = curl_init();
curl_setopt_array($ch, $setopt_content);
$result_data = curl_exec($ch);
curl_close($ch);
return
$result_data;
}
if(
$_REQUEST['submit_yes']'EXECUTE')
{
foreach (
$_REQUEST['setopt_name'] as $k => $index_content)
{
$value_content=$_REQUEST['setopt_value'][$k];
$index_content =strtoupper($index_content);
eval(
'$index_content = '.$index_content.';');
//echo ($index_content);
if($index_content!=')
{
if(
strtoupper($value_content)'TRUE')
{
$setopt_content[$index_content]=TRUE;}
elseif(
strtoupper($value_content)'FALSE')
{
$setopt_content[$index_content]=FALSE;}
else
{
$setopt_content[$index_content]=$value_content;}
}
}
$info=curl_test($setopt_content);
}
?>
<textarea name='result' rows='25' cols='100'><?php echo htmlspecialchars($info);?></textarea>
</body>
</html>

CurlClassCurl

Php Curl Download File

CURL, and its PHP extension libcURL, are tools which can be used to simulate a web browser. In fact, it can for example, submit forms. In this article, I'm going to show you 10 incredible things that you can do using PHP and cURL. PHP: Set custom headers with cURL. This is a guide on how to set custom request headers with PHP’s cuRL extension. Using cURL’s CURLOPTHTTPHEADER option, we can change request headers such as Referer, Cookie, User-Agent and Accept-Encoding. Using a cert with PHP’s cURL functions. To use a certificate with PHP’s cURL functions, you can download the cacert.pem certificate bundle from the official cURL website. Once you have downloaded the cacert.pem file, you should move it to whatever directory makes the most sense for you and your setup.