post - imageshack API cURL -
i credentials correct.
when send image through form this:(action="http://api.imageshack.com/v2/images/"). working fine when tried send $ch = curl_init($url); failed.
code:
enter code here <form action="" method="post" enctype="multipart/form-data"> select image upload: <input type="file" name="file" id="file" multiple> <input type="text" name="auth_token" id="auth_token" value="xxxxxxxxxxxxxxxx"> <input type="text" name="api_key" id="api_key" value="xxxxxxxxxxxxxxx"> <input type="submit" value="upload image" > </form>
$url = 'http://api.imageshack.com/v2/images/';
$temp = $_files["file"]['tmp_name']; echo $temp."<br>" ; $ch = curl_init($url); curl_setopt($ch, curlopt_post, true); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_timeout, 240); curl_setopt($ch, curlopt_postfields, array( 'file'=> '@'.$temp, "key" => "xxxxxxxxxxxxxxxxxxxx", "auth_token" => "xxxxxxxxxxxxxxx" )); curl_exec($ch);
i have tried header: curl_setopt($ch, curlopt_httpheader, $headers);
and error imageshack json: {"error_code":1,"error_message":"invalid image file. file uploaded not being detected image file.","error_info":{"content-type":null,"filesize":0}}
Comments
Post a Comment