Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Need to know if this is possible.
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
josh_65665




PostPosted: Mon Nov 03, 2008 7:45 am   Post subject: Need to know if this is possible.

Can turing could read the contens of a webpage into a string.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Mon Nov 03, 2008 10:27 am   Post subject: RE:Need to know if this is possible.

Quote:

Need to know if this is possible.

Yes, it is.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
DemonWasp




PostPosted: Mon Nov 03, 2008 10:35 am   Post subject: RE:Need to know if this is possible.

As Tony said, yes. Look at the Net set of commands in the Turing help.

And what Tony is hinting at is that you should ask what you really mean: "how do I do X?"
josh_65665




PostPosted: Mon Nov 03, 2008 12:03 pm   Post subject: Re: Need to know if this is possible.

ok thank you I figured it out however turing does get some html but its not right.


for exemple getting google.ca for me gets


<HTML><HEAD><meta
http-equiv="content-type"
content="text/html;charset=utf-8">
<TITLE>302
Moved</TITLE></HEAD><BODY>
<H1>302
Moved</H1>
The
document
has
moved
<A
HREF="http://www.google.ca/index.html">here.
</BODY></HTML>


but should get


<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Google</title><script>window.google={kEI:"3ksPSaflB5HSgAL44tiDAg",kEXPI:"19021",kHL:"en"};
function sf(){document.f.q.focus()}
window.rwt=function(b,d,e,g,h,f,i){var a=encodeURIComponent||escape,c=b.href.split("#");b.href="/url?sa=t"+(d?"&oi="+a(d):"")+(e?"&cad="+a(e):"")+"&ct="+a(g)+"&cd="+a(h)+"&url="+a(c[0]).replace(/\+/g,"%2B")+"&ei=3ksPSaflB5HSgAL44tiDAg"+(f?"&usg="+f:"")+i+(c[1]?"#"+c[1]:"");b.onmousedown="";return true};
window.gbar={};(function(){var b=window.gbar,f,h;b.qs=function(a){var c=window.encodeURIComponent&&(document.forms[0].q||"").value;if(c)a.href=a.href.replace(/([?&])q=[^&]*|$/,function(i,g){return(g||"&")+"q="+encodeURIComponent(c)})};function j(a,c){a.visibility=h?"hidden":"visible";a.left=c+"px"}b.tg=function(a){a=a||window.event;var c=0,i,g=window.navExtra,d=document.getElementById("gbi"),e=a.target||a.srcElement;a.cancelBubble=true;if(!f){f=document.createElement(Array.every||window.createPopup?"iframe":"div");f.frameBorder="0";f.src="#";d.parentNode.appendChild(f).id="gbs";if(g)for(i in g)d.insertBefore(g[i],d.firstChild).className="gb2";document.onclick=b.close}if(e.className!="gb3")e=e.parentNode;do c+=e.offsetLeft;while(e=e.offsetParent);j(d.style,c);f.style.width=d.offsetWidth+"px";f.style.height=d.offsetHeight+"px";j(f.style,c);h=!h};b.close=function(a){h&&b.tg(a)}})();</script></head><body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000 onload="sf();if(document.images){new Image().src='/images/nav_logo3.png'}" topmargin=3 marginheight=3><div id=gbar><nobr>Web <a href="http://images.google.ca/imghp?hl=en&tab=wi" onclick=gbar.qs(this) class=gb1>Images <a href="http://maps.google.ca/maps?hl=en&tab=wl" onclick=gbar.qs(this) class=gb1>Maps <a href="http://news.google.ca/nwshp?hl=en&tab=wn" onclick=gbar.qs(this) class=gb1>News <a href="http://video.google.ca/?hl=en&tab=wv" onclick=gbar.qs(this) class=gb1>Video Gmail <a href="http://www.google.ca/intl/en/options/" onclick="this.blur();gbar.tg(event);return !1" class=gb3>more <small>▼</small><div id=gbi> <a href="http://groups.google.ca/grphp?hl=en&tab=wg" onclick=gbar.qs(this) class=gb2>Groups <a href="http://books.google.ca/bkshp?hl=en&tab=wp" onclick=gbar.qs(this) class=gb2>Books <a href="http://scholar.google.ca/schhp?hl=en&tab=ws" onclick=gbar.qs(this) class=gb2>Scholar <a href="http://finance.google.ca/finance?hl=en&tab=we" onclick=gbar.qs(this) class=gb2>Finance <a href="http://blogsearch.google.ca/?hl=en&tab=wb" onclick=gbar.qs(this) class=gb2>Blogs <div class=gb2><div class=gbd></div></div> <a href="http://ca.youtube.com/?hl=en&tab=w1" onclick=gbar.qs(this) class=gb2>YouTube Calendar <a href="http://picasaweb.google.ca/home?hl=en&tab=wq" onclick=gbar.qs(this) class=gb2>Photos Documents Sites <div class=gb2><div class=gbd></div></div> even more &raquo;</div> </nobr></div><div class=gbh style=left:0></div><div class=gbh style=right:0></div><div align=right id=guser style="font-size:84%;padding:0 0 4px" width=100%><nobr>josh65665@gmail.com | iGoogle | My Account | <a href="/accounts/ClearSID?continue=http://www.google.com/accounts/Logout%3Fcontinue%3Dhttp://www.google.ca/">Sign out</nobr></div><center><br clear=all id=lgpd><img alt="Google" height=110 src="/intl/en_ca/images/logo.gif" width=276><br><br><form action="/search" name=f><table cellpadding=0 cellspacing=0><tr valign=top><td width=25%>&nbsp;</td><td align=center nowrap><input name=hl type=hidden value=en><input maxlength=2048 name=q size=55 title="Google Search" value=""><br><input name=btnG type=submit value="Google Search"><input name=btnI type=submit value="I'm Feeling Lucky"></td><td nowrap width=25%><font size=-2>&nbsp;&nbsp;Advanced Search<br>&nbsp;&nbsp;Preferences<br>&nbsp;&nbsp;Language Tools</font></td></tr><tr><td align=center colspan=3><font size=-1><span style="text-align:left">Search: <input id=all type=radio name=meta value="" checked><label for=all> the web </label><input id=cty type=radio name=meta value="cr=countryCA"><label for=cty> pages from Canada </label></span></font></td></tr></table></form><br><font size=-1>Google.ca offered in: Fran?ais </font><br><br><br><font size=-1>Advertising&nbsp;Programs - Business Solutions - About Google - Go to Google.com</font><p><font size=-2>&copy;2008 - Privacy</font></p></center></body></html>


heres the code Im using

code:

        var url : string
        put "Enter the URL to load: " ..
        get url
       
        var netStream : int
        var line : string
       
        netStream := Net.OpenURLConnection (url)
        if netStream <= 0 then
            put "Unable to connect to ", url
            return
        end if
        loop
            exit when eof (netStream)
            get : netStream, line
            put line
        end loop
        Net.CloseConnection (netStream)


This was taken right from the help file
andrew.




PostPosted: Mon Nov 03, 2008 4:39 pm   Post subject: RE:Need to know if this is possible.

I think when you say google.ca, it's going to google.ca and the source there redirects you to the real Google webpage you're thinking of. But Turing is not an internet browser so it does not interpret the HTML so it brings this back. A lot of websites do this.
josh_65665




PostPosted: Mon Nov 03, 2008 5:17 pm   Post subject: RE:Need to know if this is possible.

But if I get it to go to the link in the given page it doesent work.

This happens with all websites it wont get the proper html
jbking




PostPosted: Mon Nov 03, 2008 5:41 pm   Post subject: Re: Need to know if this is possible.

How sure are you of having the proper URL and proper user agent in getting the HTML back? Don't forget that sites may detect what is looking on the site and change its appearance accordingly as well as needing to get to the proper spot on the site.

Did you try using http://www.google.ca/index.html rather than just "http://google.ca"?
josh_65665




PostPosted: Mon Nov 03, 2008 6:53 pm   Post subject: RE:Need to know if this is possible.

Yes as I have said it doesnt work with any url.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: