i'm trying to get result from this site by using cURL. its just return white page not with the download link.what's wrong with my code?
This's my codes
<?php
// Define URL where the form resides
$form_url = "http://www.tusfiles.net/83gjiu9h49nw";
// This is the data to POST to the form. The KEY of the array is the name of the field. The value is the value posted.
$data_to_post = array();
$data_to_post['op'] = 'download2';
$data_to_post['id'] = '83gjiu9h49nw';
$data_to_post['rand'] = 'utpaxiqp4ocv6krspq5geslurstt7z3bmvt5eqa';
$data_to_post['referer'] = '';
$data_to_post['method_free'] = '';
$data_to_post['method_premium'] = '';
$data_to_post['submit'] = 'Direct download link';
// Initialize cURL
$curl = curl_init();
// Set the options
curl_setopt($curl,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
curl_setopt($curl,CURLOPT_URL, $form_url);
// This sets the number of fields to post
curl_setopt($curl,CURLOPT_POST, sizeof($data_to_post));
// This is the fields to post in the form of an array.
curl_setopt($curl,CURLOPT_POSTFIELDS, $data_to_post);
//execute the post
$result = curl_exec($curl);
//close the connection
curl_close($curl);
?>
Thx
You may need to url encode the data in the body of your POST request. So instead of:
$data_to_post['submit'] = 'Direct download link';
You'd have:
$data_to_post['submit'] = urlencode('Direct download link');