Reputation: 55
i am new to php and i want to get a webpage html through the use of php curl...i am not getting the output,am just getting a white page. Can anyone please help?
<?php
$url=$_POST['txturl'];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$output = curl_exec($ch);
echo $output;
curl_close($ch);
?>
Upvotes: 2
Views: 14845
Reputation: 68476
You don't need to send URL twice
<?php
$url=$_POST['txturl'];
$ch = curl_init();//I have removed it from here
curl_setopt($ch, CURLOPT_URL,$url);// This will do
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$output = curl_exec($ch);
echo $output;
curl_close($ch);
?>
<?php
echo function_exists('curl_version')?'Yes':'No';
?>
Upvotes: 6