How to save binary data in MySQL using PHP?
<p>i want to download the image from one server, and want to save the binery data into mysql blob field. but its not working. </p>

<ol>
<li><p>if i am displaying the $picture1 then it shows the un-readable characters. byt $picture2 is not displaying.</p></li>
<li><p>if i try to save it in the table, then its not saving in the table.</p></li>
</ol>

<p>how can i save this into my blob field.</p>

<pre><code>$picture1 = GetImageFromUrl($url);
$picture2 = addslashes(fread(fopen($picture, "r"), filesize($picture)));

print_r($picture1)
print_r($picture2)

function GetImageFromUrl($link)
{

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_POST, 0); 
curl_setopt($ch,CURLOPT_URL,$link); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
$result=curl_exec($ch); 
curl_close($ch); 
return $result;
}
</code></pre>
