Ankündigung

Einklappen
Keine Ankündigung bisher.

Google Inhalte parsen, geht nicht wegen Ajax

Einklappen

Neue Werbung 2019

Einklappen
X
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Google Inhalte parsen, geht nicht wegen Ajax

    Hallo Leute,

    folgendes. Ich möchte die Ergebnisse der ersten 10 Einträge von Google holen, leider funktioniert das nicht wirklich.

    Ich bekomme nur den HTML Code + JavaScript Code, welcher bei Anfrage an Google übermittelt wird, der Inhalt wird kurz danach via JavaScript dynamisch nachgeladen. Gibt es eine Möglichkeit diesen Prozess zu simmulieren, um den HTML Code zu erhalten.

    Wäre über Hilfe sehr erfreut.

    Liebe Grüße

    Omex

  • #2
    da fällt mir nur cURL ein ...
    "Irren ist männlich", sprach der Igel und stieg von der Drahtbürste [IMG]http://www.php.de/core/images/smilies/icon_lol.gif[/IMG]

    Kommentar


    • #3
      ....

      Kommentar


      • #4
        hehe, gute idee xD. nutze zend, bin damit ganz zufrieden, nur jetzt hänge ich einfach.

        bei einer einfachen anfrage bekomme als inhalt:

        Code:
        <!doctype html><html><head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><title>Google</title><script>window.google={kEI:"5M2ITPfULZaj-Ab1wsn9DQ",kEXPI:"25900,26087,26446",kCSI:{e:"25900,26087,26446",ei:"5M2ITPfULZaj-Ab1wsn9DQ",expi:"25900,26087,26446"},ml:function(){},kHL:"de",time:function(){return(new Date).getTime()},log:function(b,d,c){var a=new Image,e=google,g=e.lc,f=e.li;a.onerror=(a.onload=(a.onabort=function(){delete g[f]}));g[f]=a;c=c||"/gen_204?atyp=i&ct="+b+"&cad="+d+"&zx="+google.time();a.src=c;e.li=f+1},lc:[],li:0,Toolbelt:{}};
        window.google.sn="webhp";window.google.timers={load:{t:{start:(new Date).getTime()}}};try{}catch(u){}window.google.jsrt_kill=1;
        var _gjwl=location;function _gjuc(){var e=_gjwl.href.indexOf("#");if(e>=0){var a=_gjwl.href.substring(e);if(a.indexOf("&q=")>0||a.indexOf("#q=")>=0){a=a.substring(1);if(a.indexOf("#")==-1){for(var c=0;c<a.length;){var d=c;if(a.charAt(d)=="&")++d;var b=a.indexOf("&",d);if(b==-1)b=a.length;var f=a.substring(d,b);if(f.indexOf("fp=")==0){a=a.substring(0,c)+a.substring(b,a.length);b=c}else if(f=="cad=h")return 0;c=b}_gjwl.href="/search?"+a+"&cad=h";return 1}}}return 0}function _gjp(){!(window._gjwl.hash&&
        window._gjuc())&&setTimeout(_gjp,500)};
        window._gjp && _gjp()</script><style id=gstyle>body{margin:0}#gog{padding:3px 8px 0}td{line-height:.8em}.gac_m td{line-height:17px}form{margin-bottom:20px}body,td,a,p,.h{font-family:arial,sans-serif}.h{color:#36c;font-size:20px}.q{color:#00c}.ts td{padding:0}.ts{border-collapse:collapse}em{font-weight:bold;font-style:normal}.lst{width:496px}.tiah{width:458px}input{font-family:inherit}a.gb1,a.gb2,a.gb3,a.gb4{color:#11c !important}#gog{background:#fff}#gbar,#guser{font-size:13px;padding-top:1px !important}#gbar{float:left;height:22px}#guser{padding-bottom:7px !important;text-align:right}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}#gbs,.gbm{background:#fff;left:0;position:absolute;text-align:left;visibility:hidden;z-index:1000}.gbm{border:1px solid;border-color:#c9d7f1 #36c #36c #a2bae7;z-index:1001}.gb1{margin-right:.5em}.gb1,.gb3{zoom:1}.gb2{display:block;padding:.2em .5em}.gb2,.gb3{text-decoration:none;border-bottom:none}a.gb1,a.gb2,a.gb3,a.gb4{color:#00c !important}a.gb2:hover{background:#36c;color:#fff !important}body{background:#fff;color:black}input{-moz-box-sizing:content-box}a{color:#11c;text-decoration:none}a:hover,a:active{text-decoration:underline}.fl a{color:#4272db}a:visited{color:#551a8b}a.gb1,a.gb4{text-decoration:underline}a.gb3:hover{text-decoration:none}#ghead a.gb2:hover{color:#fff!important}.ds{display:-moz-inline-box}.ds{border-bottom:solid 1px #e7e7e7;border-right:solid 1px #e7e7e7;display:inline-block;margin:3px 0 4px;margin-left:4px}.sblc{padding-top:5px}.sblc a{display:block;margin:2px 0;margin-left:13px;font-size:11px;}.lsbb{background:#eee;border:solid 1px;border-color:#ccc #999 #999 #ccc;height:30px;display:block}.lsb{background:url(/images/srpr/nav_logo14.png) bottom;font:15px arial,sans-serif;border:none;color:#000;cursor:pointer;height:30px;margin:0;outline:0;vertical-align:top}.lsb:active{background:#ccc}.lst:focus{outline:none}.ftl,#fll a{margin:0 12px}#addlang a{padding:0 3px}.gac_v div{display:none}.gac_v .gac_v2,.gac_bt{display:block!important}</style><script>google.y={};google.x=function(e,g){google.y[e.id]=[e,g];return false};window.gbar={qs:function(){},tg:function(e){var o={id:'gbar'};for(i in e)o[i]=e[i];google.x(o,function(){gbar.tg(o)})}};</script></head><body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000 onload="document.f.q.focus();if(document.images)new Image().src='/images/srpr/nav_logo14.png'" ><textarea id=csi style=display:none></textarea><div id=ghead><div id=gog><div id=gbar><nobr><b class=gb1>Web</b> <a href="http://www.google.de/imghp?hl=de&tab=wi" onclick=gbar.qs(this) class=gb1>Bilder</a> <a href="http://video.google.de/?hl=de&tab=wv" onclick=gbar.qs(this) class=gb1>Videos</a> <a href="http://maps.google.de/maps?hl=de&tab=wl" onclick=gbar.qs(this) class=gb1>Maps</a> <a href="http://news.google.de/nwshp?hl=de&tab=wn" onclick=gbar.qs(this) class=gb1>News</a> <a href="http://www.google.de/prdhp?hl=de&tab=wf" onclick=gbar.qs(this) class=gb1>Shopping</a> <a href="http://mail.google.com/mail/?hl=de&tab=wm" class=gb1>E-Mail</a> <a href="http://www.google.de/intl/de/options/" onclick="this.blur();gbar.tg(event);return !1" aria-haspopup=true class=gb3><u>Mehr</u> <small>▼</small></a><div class=gbm id=gbi><a href="http://books.google.de/bkshp?hl=de&tab=wp" onclick=gbar.qs(this) class=gb2>B�cher</a> <a href="http://translate.google.de/?hl=de&tab=wT" onclick=gbar.qs(this) class=gb2>�bersetzer</a> <a href="http://blogsearch.google.de/?hl=de&tab=wb" onclick=gbar.qs(this) class=gb2>Blogs</a> <a href="http://www.google.de/realtime?hl=de&tab=wY" onclick=gbar.qs(this) class=gb2>Statusupdates</a> <div class=gb2><div class=gbd></div></div><a href="http://www.youtube.com/?hl=de&tab=w1&gl=DE" onclick=gbar.qs(this) class=gb2>YouTube</a> <a href="http://www.google.com/calendar/render?hl=de&tab=wc" class=gb2>Kalender</a> <a href="http://picasaweb.google.de/home?hl=de&tab=wq" onclick=gbar.qs(this) class=gb2>Fotos</a> <a href="http://docs.google.com/?hl=de&tab=wo" class=gb2>Text &amp; Tabellen</a> <a href="http://www.google.de/reader/?hl=de&tab=wy" class=gb2>Reader</a> <a href="http://sites.google.com/?hl=de&tab=w3" class=gb2>Sites</a> <a href="http://groups.google.de/grphp?hl=de&tab=wg" onclick=gbar.qs(this) class=gb2>Groups</a> <div class=gb2><div class=gbd></div></div><a href="http://www.google.de/intl/de/options/" class=gb2>und noch mehr &raquo;</a> </div></nobr></div><div id=guser width=100%><nobr><span id=gbn class=gbi></span><span id=gbf class=gbf></span><span id=gbe><a href="/url?sa=p&pref=ig&pval=3&q=http://www.google.de/ig%3Fhl%3Dde%26source%3Diglk&usg=AFQjCNFjfPavRPBJrOKJS3MB2uzhpfN6zw" class=gb4>iGoogle</a> | </span><a href="/preferences?hl=de" class=gb4>Sucheinstellungen</a> | <a href="https://www.google.com/accounts/Login?hl=de&continue=http://www.google.de/" class=gb4>Anmelden</a></nobr></div><div class=gbh style=left:0></div><div class=gbh style=right:0></div></div></div> <center><br clear=all id=lgpd><div id=lga><div style="padding:28px 0 3px"><div align=left style="background:url(/intl/en_com/images/srpr/logo1w.png) no-repeat;height:110px;width:276px" title="Google" id=logo onload="window.lol&&lol()"><div nowrap style="color:#777;font-size:16px;font-weight:bold;left:214px;position:relative;top:70px">Deutschland</div></div></div><br></div><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=de><input name=source type=hidden value=hp><input type=hidden name=ie value="ISO-8859-1"><div class=ds style="height:32px;margin:4px 0"><input autocomplete="off" maxlength=2048 name=q class="lst" title="Google-Suche" value="" size=57 style="background:#fff;border:1px solid #ccc;border-bottom-color:#999;border-right-color:#999;color:#000;font:18px arial,sans-serif bold;height:25px;margin:0;padding:5px 8px 0 6px;vertical-align:top"></div><br style="line-height:0"><span class=ds ><span class=lsbb><input name=btnG type=submit value="Google-Suche" class=lsb></span></span><span class=ds><span class=lsbb><input name=btnI type=submit value="Auf gut Gl�ck!" class=lsb></span></span></td><td nowrap width=25% align=left class=sblc><a href="/advanced_search?hl=de">Erweiterte Suche</a><a href="/language_tools?hl=de">Sprachoptionen</a></td></tr></table></form><div style="font-size:83%;min-height:3.5em"><br></div><div id=res></div><span id=footer><center id=fctr><div style="font-size:10pt"><div id=fll style="margin:19px auto 19px auto;text-align:center"><a href="/intl/de/ads/">Werben mit Google</a><a href="/services/">Unternehmensangebote</a><a href="/intl/de/about.html">�ber Google</a><a href="http://www.google.com/ncr">Google.com in English</a></div></div><p style="color:#767676;font-size:8pt">&copy; 2010 - <a href="/intl/de/privacy.html">Datenschutz</a></p></center></span> <div id=xjsd></div><div id=xjsi><script>if(google.y)google.y.first=[];if(google.y)google.y.first=[];google.dstr=[];google.rein=[];window.setTimeout(function(){var a=document.createElement("script");a.src="/extern_js/f/CgJkZRICZGUgACswRTgBLCswWjgALCswDjgBLCswFzgHLCswJzgELCswPDgALCswUTgALCswCjhzQB0sKzAWOB0sKzAZOCAsKzAlOM-IASwrMDU4BCwrMEA4EywrMEE4BSwrME44BiwrMFQ4ASwrMBg4BSwrMCY4DiyAAheQAho/9aZ7xt2fdg8.js";(document.getElementById("xjsd")||document.body).appendChild(a);if(google.timers&&google.timers.load.t)google.timers.load.t.xjsls=(new Date).getTime();},0);
        google.neegg=1;google.y.first.push(function(){var form=document.f||document.f||document.gs;google.ac.i(form,form.q,'','','',{o:1,sw:1});google.mc = [[14,{}]];google.med('init');google.History&&google.History.initialize('/')});if(google.j&&google.j.en&&google.j.xi){window.setTimeout(google.j.xi,0);google.fade=null;}</script></div><script>(function(){
        var b,d,e,f;function g(a,c){if(a.removeEventListener){a.removeEventListener("load",c,false);a.removeEventListener("error",c,false)}else{a.detachEvent("onload",c);a.detachEvent("onerror",c)}}function h(a){f=(new Date).getTime();++d;a=a||window.event;var c=a.target||a.srcElement;g(c,h)}var i=document.getElementsByTagName("img");b=i.length;d=0;for(var j=0,k;j<b;++j){k=i[j];if(k.complete||typeof k.src!="string"||!k.src)++d;else if(k.addEventListener){k.addEventListener("load",h,false);k.addEventListener("error",
        h,false)}else{k.attachEvent("onload",h);k.attachEvent("onerror",h)}}e=b-d;function l(){if(!google.timers.load.t)return;google.timers.load.t.ol=(new Date).getTime();google.timers.load.t.iml=f;google.kCSI.imc=d;google.kCSI.imn=b;google.kCSI.imp=e;google.timers.load.t.xjs&&google.report&&google.report(google.timers.load,google.kCSI)}if(window.addEventListener)window.addEventListener("load",l,false);else if(window.attachEvent)window.attachEvent("onload",l);google.timers.load.t.prt=(f=(new Date).getTime());
        })();
        </script>
        leider bin ich keine javascriptler und habe keine ahnung wo dort google den "neuen" http request für den empfang des inhalts herholt.

        Kommentar


        • #5
          Benutz die normale API von Google und klau nicht einfach irgendwelche Inhalte!
          "[URL="http://www.youtube.com/watch?v=yMAa_t9k2VA&feature=youtu.be&t=25s"]Mein Name ist Lohse, ich kaufe hier ein.[/URL]"

          Kommentar


          • #6
            Wie wäre es mit der Google AJAX Api

            Google AJAX Search API - Google Code

            Wolf29
            while (!asleep()) sheep++;

            Unterschätze nie jemanden der einen Schritt zurück geht! Er könnte Anlauf nehmen.

            Kommentar


            • #7
              Anstatt dich mit dem JavaScript-Code herumzuschlagen, solltest du lieber gleich die API von Google nutzen.
              [SIZE="1"]RGB is totally confusing - I mean, at least #C0FFEE should be brown, right?[/SIZE]

              Kommentar


              • #8
                Und wenn es php sein soll tut es die Google REST API
                [IMG]http://media.ubuntuusers.de/portal/files/ubuntu.png[/IMG][IMG]http://sqlmanager.net/i/ico/mysql.gif[/IMG][SIGPIC][/SIGPIC]

                Kommentar


                • #9
                  Nutz doch die API.



                  APIAPIAPI
                  API



                  API.
                  [COLOR="#F5F5FF"]--[/COLOR]
                  [COLOR="Gray"][SIZE="6"][FONT="Georgia"][B]^^ O.O[/B][/FONT] [/SIZE]
                  „Emoticons machen einen Beitrag etwas freundlicher. Deine wirken zwar fachlich richtig sein, aber meist ziemlich uninteressant.
                  [URL="http://www.php.de/javascript-ajax-und-mehr/107400-draggable-sorttable-setattribute.html#post788799"][B]Wenn man nur Text sieht, haben viele junge Entwickler keine interesse, diese stumpfen Texte zu lesen.“[/B][/URL][/COLOR]
                  [COLOR="#F5F5FF"]
                  --[/COLOR]

                  Kommentar


                  • #10
                    Was geht denn mit euch ab?

                    Wieso nutzt er denn nicht die Google API? Wer will nochmal API schreiben?

                    Kommentar


                    • #11
                      Ach wei, muss jetzt er pAPI kommen, um hier mal für Ordnung zu sorgen?
                      Refining Linux: “[url=http://www.refining-linux.org/archives/65/Performing-push-backups-Part-1-rdiff-backup/]Performing Push Backups – Part 1: rdiff-backup[/url]”

                      Kommentar

                      Lädt...
                      X