Link to home
Start Free TrialLog in
Avatar of re-searcher
re-searcherFlag for United States of America

asked on

Php cURL problem for showing html source

Hello,
I wanna retrieve html page content with curl and show it, i can print english pages like google, but for arabic content i have a problem and result is smth like following code:
¿X¿M¿u~¿¿G¿¿]¿¿¿¿¿¿4o¿UU¿¿¿u{]¿¿i¿|¿¿y¿¿G ¿n¿y¿~¿¿¿¿¿¿]{¿¿¿~¿$¿¿q3¿¿U¿¿¿¿2¿O¿-¿¿¿X¿¿¿¿¿T[;¿t¿¿a¿¿:o¿¿{z?¿¿b¿¿G¿¿5¿¿y¿n¿¿c¿W¿u¿e¿x|¿^"¿$¿_O¿¿5¿¿¿¿^¿¿lAx¿¿¿¿E¿¿+¿¿jh¿¿¿d¿v\¿Ys¿Z¿¿M¿V¿¿}¿Wwv¿Y¿z¿{¿¿¿¿¿3¿¿#¿&¿N¿>¿¿¿Q,WkC¿y1¿¿¿¿¿¿¿?¿¿¿o¿¿¿¿¿¿¿¿2+¿¿P¿¿fH¿¿W_¿¿¿¿¿¿¿¿~¿¿¿¿^H¿¿¿¿g¿¿}¿¿¿¿¿¿}¿P¿^¿¿|z¿¿¿¿s¿{_¿¿WW/¿¿¿¿¿>¿8;9¿¿¿¿¿8¿u¿o¿¿y¿¿xv¿¿¿¿¿¿=¿¿w~¿¿x¿¿¿¿u¿¿g;¿¿w¿¿¿¿¿¿¿t¿¿¿¿¿O^¿>{?¿¿¿¿wZ¿}¿¿'¿¿}¿'¿}u¿¿|¿¿W¿¿¿¿¿¿'¿¿O¿ ¿¿¿¿¿¿¿¿>¿^Q¿¿¿¿gO¿¿¿¿¿5¿>¿¿¿~¿¿¿¿¿¿¿¿¿¿N/¿¿'O¿¿S¿¿w~¿}¿¿¿¿¿¿?¿¿¿L¿¿8¿¿¿¿¿n¿¿*_~¿~9¿_]¿>¿j¿=¿¿}¿V¿¿¿¿O

Open in new window


my sample code is:
/* gets the data from a URL */
function get_data($url) {
	$ch = curl_init();
	$timeout = 5;
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
	$data = curl_exec($ch);
	curl_close($ch);
	return $data;
}

$returned_content = get_data('http://www.google.com');

echo $returned_content;

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial