Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

iPhoneSpain

macrumors newbie
Original poster
Sep 27, 2009
28
0
Hello everyone,

I have a problem with ASIHTTPRequest framework. Everything seemed to work fine till last week but I don't know what's happening right now.

I want to get de source code of this web so as to get the pictures inside:

http://maps.google.com/maps/place?cid=7227052550345060198&view=feature&mcsrc=photo&num=50

The beginning of the source code via a web explorer is:

Code:
<!DOCTYPE html><html><head><meta http-equiv=X-UA-Compatible content=IE=EmulateIE7 /><title>Winchester Mystery House - Google Maps</title><script type=text/javascript></script><script>
<!--
var a;function e(id){return document.getElementById(id)}function v(id){return e(id).value}function vs(id,val){e(id).value=val}function d0(id){e(id).style.display="none"}function d1(id){e(id).style.display=""}function u(v){return typeof v=="undefined"}
function GXhrGet(url,opt_callback){var req;if(window.XMLHttpRequest)req=new XMLHttpRequest;else if(typeof ActiveXObject!="undefined")req=new ActiveXObject("Microsoft.XMLHTTP");req.onreadystatechange=function(){if(req.readyState==4)if(req.status==200){opt_callback&&opt_callback(req.responseText);req.onreadystatechange=function(){}}};req.open("GET",url,true);req.send("")};function

And the result of ASIHTTPRequest is:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml12.dtd">
 <wml> <head> <meta http-equiv="Content-Type" content="text/vnd.wap.wml; charset=UTF-8"/> <meta http-equiv="Cache-Control" content="no-cache"/> </head> <card title="Winchester Mystery House - Geschäftsinformationen"> <onevent type="onenterforward"> <refresh> <setvar name="site" value=""/> <setvar name="q" value=""/> </refresh> </onevent>  <p>   <img src="http://www.gstatic.com/m/images/logo_small.gif" width="48" height="17" alt="Google"/> <br/>  </p> <p>    <a href="/m/place?action=addfav&source=mpp&cid=7227052550345060198&title=Winchester+Mystery+House&sig=AMctaOJjgjFNesGsK9sEibZQSXZuwNXh9A"> <img src="http://www.gstatic.com/m/images/stars/unstarred.gif"

As you can see, they are kind of different. I've tried using the following code with no luck (the result is null)

Code:
photos=[NSString stringWithContentsOfURL:[NSURL URLWithString:photos] usedEncoding:nil error:nil];

Any idea? I'd be very grateful if anyone could help me get this fixed.

Thanks in advance
 
That is not the same as?

photos=[NSString stringWithContentsOfURL:[NSURL URLWithString:photos] usedEncoding:nil error:nil];
 
Don't use those synchronous methods for downloading files. They're very error prone.

The two documents you show are html and xml. If you are downloading the exact same URL then maybe google maps determines what it wants to send based on the user agent. Is it possible that your ASIHTTPRequest is a POST? That might also be a difference.

The xml is intended to be parsed by applications so maybe that's what you really want.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.