ajax with html issue

Yoh Asakura

New Member
I want to get the html of a website to check it for links,I use the following ajax code to get the html of a remote website:\[code\]$.ajax({ type : 'get', url : 'proxy.php', dataType : 'html', success : function(data){ alert('success'); }, error : function(XMLHttpRequest, textStatus, errorThrown) { alert('error'); }});\[/code\]proxy.php is the proxy I use to get the data because it is not on my server :\[code\]<?php// Set your return content typeheader('Content-type: application/html');// Website url to open$daurl = 'http://example.com';// Get that website's content$handle = fopen($daurl, "r");// If there is something, read and returnif ($handle) { while (!feof($handle)) { $buffer = fgets($handle, 4096); echo $buffer; } fclose($handle);}?>\[/code\]the code always alert the error and I can not understand is everything is OK because I am not expert with ajax so I want anybody that could check that for me? is it wrong ajax datatype? is it wrong header in proxy file please???
 
Top