fallen kindom
New Member
i dont know why this generated xml: here appear from the first load (only for few seconds) as text, and after like xml. Problem is that i want to send via cURL. I thought that problem is in generating XML with DOM, so i tryed XML_Serializer from PEAR, but the result is same. Another reason is that i thought it could be generating Base64_encode(image) but if i saved this file from browser and try to push only this file in testing mode(it says that's ok). And if i try to put this file(stored with browser) to web folder(upload via FTP) and display in browser, it's been displayed normally. (no with 1-2 sec. as code from start).I have rly headache from this. So i will be pleased for any think what i need to do. Ty for rply. <?phpsession_start();ob_start();$property_id = $_GET['u'];function resizeImage($image,$width,$height,$scale) { list($imagewidth, $imageheight, $imageType) = getimagesize($image); $imageType = image_type_to_mime_type($imageType); $newImageWidth = ceil($width * $scale); $newImageHeight = ceil($height * $scale); $newImage = imagecreatetruecolor($newImageWidth,$newImageHeight); switch($imageType) { case "image/gif": $source=imagecreatefromgif($image); break; case "image/pjpeg": case "image/jpeg": case "image/jpg": $source=imagecreatefromjpeg($image); break; case "image/png": case "image/x-png": $source=imagecreatefrompng($image); break; } imagecopyresampled($newImage,$source,0,0,0,0,$newImageWidth,$newImageHeight,$width,$height); switch($imageType) { case "image/gif": imagegif($newImage,$image); break; case "image/pjpeg": case "image/jpeg": case "image/jpg": imagejpeg($newImage,$image,90); break; case "image/png": case "image/x-png": imagepng($newImage,$image); break; } chmod($image, 0777); return $image;}//xml readerfunction xml2assoc($xml) { $arr = array(); if (!preg_match_all('|\<\s*?(\w+).*?\>(.*)\<\/\s*\\1.*?\>|s', $xml, $m)) return $xml; if (is_array($m[1])) for ($i = 0;$i < sizeof($m[1]); $i++) $arr[$m[1][$i]] = xml2assoc($m[2][$i]); else $arr[$m[1]] = xml2assoc($m[2]); return $arr;}//na obrazkyfunction encodeme($encodeMe) { $data = http://stackoverflow.com/questions/13801134/base64_encode($encodeMe); $datalb =""; while (strlen($data) > 64) { $datalb .= substr($data, 0, 64) . "\n"; $data = http://stackoverflow.com/questions/13801134/substr($data,64); } $datalb .= $data; return $datalb; } // cURLfunction get_web_page( $url,$curl_data ) { $options = array( CURLOPT_BUFFERSIZE => 25000, CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_BINARYTRANSFER => true, CURLOPT_HEADER => false, // don't return headers CURLOPT_FOLLOWLOCATION => false, // follow redirects CURLOPT_ENCODING => "", // handle all encodings CURLOPT_USERAGENT => "bvsreal", // who am i CURLOPT_AUTOREFERER => true, // set referer on redirect CURLOPT_CONNECTTIMEOUT => 12000, // timeout on connect CURLOPT_TIMEOUT => 12000, // timeout on response CURLOPT_MAXREDIRS => 10, // stop after 10 redirects CURLOPT_POST => true, // i am sending post data CURLOPT_POSTFIELDS => $curl_data, // this are my post vars CURLOPT_SSL_VERIFYHOST => 0, // don't verify ssl CURLOPT_SSL_VERIFYPEER => false, // CURLOPT_VERBOSE => 1 // ); $ch = curl_init($url); curl_setopt_array($ch,$options); $content = curl_exec($ch); $err = curl_errno($ch); $errmsg = curl_error($ch) ; $header = curl_getinfo($ch); curl_close($ch); // $header['errno'] = $err; // $header['errmsg'] = $errmsg; $header['content'] = xml2assoc($content); return $header; } //co bude inzerat zac (I - insert, U - update, D - delete)$typ_operace = $_GET['typ_operace'];if(!$typ_operace) $typ_operace = 'I'; // defaultn