hi i wrote this script to get the html of a website but i see "Invalid Request" Error, but when i create a html form and submit it i have no problem, whats the problem? here is my php code :
<?php
$url = 'http://ift.tt/1yodgBU';
$fields = array(
'url' => urlencode("http://ift.tt/VW2IZx"),
'format' => urlencode("3gp")
);
//url-ify the data for the POST
$fields_string="";
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_AUTOREFERER,true);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
?>
Aucun commentaire:
Enregistrer un commentaire