<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[PHP Server Sendet Werbung]]></title><description><![CDATA[<p>Hallo,<br />
Ich greife auf einen PHP Server zu um dort<br />
Daten abzurufen.<br />
Das Programm speichert die Antwort in einem Array und wertet sie danach aus:<br />
Manchmal stürzt mein Programm leider übelst ab.<br />
Nach stundenlangem Debuggen hab ich den Grund herrausgefunden:<br />
Der PHP Server sendet statt einer vernünftigen Antwort vorher<br />
erstmal einen Werbe-Layer:</p>
<pre><code>HTTP/1.1 200 OK
Date: Fri, 19 Jan 2007 11:01:09 GMT
Server: Apache/1.3.34 (Debian) PHP/5.2.0-8
X-Powered-By: PHP/5.2.0-8
Set-Cookie: PHPSESSID=ddbd1c08b995f7b8e72e366a2a5774c5; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Connection: close
Content-Type: text/html; charset=UTF-8

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.1//EN&quot; &quot;http://www.w3.org/TR/xhtml11/
DTD/xhtml11.dtd&quot;&gt;

&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;title&gt;Tools - Banlist.nl&lt;/title&gt;
  &lt;link href=&quot;/styles/gradients.css&quot; title=&quot;Gradients (Sidebar layout; default)&quot;
 type=&quot;text/css&quot; rel=&quot;stylesheet&quot; media=&quot;screen&quot; /&gt;
  &lt;link href=&quot;/styles/print.css&quot; type=&quot;text/css&quot; rel=&quot;stylesheet&quot; media=&quot;print&quot;
/&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;div id=&quot;contentjumper&quot;&gt;
    &lt;a accesskey=&quot;j&quot; href=&quot;#main&quot; title=&quot;Jump to content&quot;&gt;Jump to content&lt;/a&gt;
  &lt;/div&gt;
  &lt;div id=&quot;title&quot;&gt;
    &lt;h1&gt;&lt;span&gt;Banlist.nl&lt;/span&gt;&lt;/h1&gt;
    &lt;div id=&quot;bannerad&quot;&gt;
      &lt;script type=&quot;text/javascript&quot; src=&quot;/include/advert.php?type=banner&amp;amp;sc
riptonly=yes&quot;&gt;&lt;/script&gt;
      &lt;script type=&quot;text/javascript&quot; src=&quot;http://pagead2.googlesyndication.com/p
agead/show_ads.js&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div id=&quot;sidebar&quot;&gt;
    &lt;div id=&quot;adblock&quot;&gt;
      &lt;h2&gt;Advertisements&lt;/h2&gt;
      &lt;div id=&quot;buttonad&quot;&gt;
        &lt;script type=&quot;text/javascript&quot; src=&quot;/include/advert.php?type=block&amp;amp;s
criptonly=yes&quot;&gt;&lt;/script&gt;
</code></pre>
<p>Was kann ich da denn jetzt machen?<br />
Ich empfange das so:</p>
<pre><code class="language-cpp">amountRecieved = recv( mySocket, cMsg, 500000, 0 );
</code></pre>
<p>Danke schonmal für eure Tatenkräftige Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/170756/php-server-sendet-werbung</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Jul 2026 15:27:31 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/170756.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 19 Jan 2007 11:04:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to PHP Server Sendet Werbung on Fri, 19 Jan 2007 11:04:52 GMT]]></title><description><![CDATA[<p>Hallo,<br />
Ich greife auf einen PHP Server zu um dort<br />
Daten abzurufen.<br />
Das Programm speichert die Antwort in einem Array und wertet sie danach aus:<br />
Manchmal stürzt mein Programm leider übelst ab.<br />
Nach stundenlangem Debuggen hab ich den Grund herrausgefunden:<br />
Der PHP Server sendet statt einer vernünftigen Antwort vorher<br />
erstmal einen Werbe-Layer:</p>
<pre><code>HTTP/1.1 200 OK
Date: Fri, 19 Jan 2007 11:01:09 GMT
Server: Apache/1.3.34 (Debian) PHP/5.2.0-8
X-Powered-By: PHP/5.2.0-8
Set-Cookie: PHPSESSID=ddbd1c08b995f7b8e72e366a2a5774c5; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Connection: close
Content-Type: text/html; charset=UTF-8

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.1//EN&quot; &quot;http://www.w3.org/TR/xhtml11/
DTD/xhtml11.dtd&quot;&gt;

&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;title&gt;Tools - Banlist.nl&lt;/title&gt;
  &lt;link href=&quot;/styles/gradients.css&quot; title=&quot;Gradients (Sidebar layout; default)&quot;
 type=&quot;text/css&quot; rel=&quot;stylesheet&quot; media=&quot;screen&quot; /&gt;
  &lt;link href=&quot;/styles/print.css&quot; type=&quot;text/css&quot; rel=&quot;stylesheet&quot; media=&quot;print&quot;
/&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;div id=&quot;contentjumper&quot;&gt;
    &lt;a accesskey=&quot;j&quot; href=&quot;#main&quot; title=&quot;Jump to content&quot;&gt;Jump to content&lt;/a&gt;
  &lt;/div&gt;
  &lt;div id=&quot;title&quot;&gt;
    &lt;h1&gt;&lt;span&gt;Banlist.nl&lt;/span&gt;&lt;/h1&gt;
    &lt;div id=&quot;bannerad&quot;&gt;
      &lt;script type=&quot;text/javascript&quot; src=&quot;/include/advert.php?type=banner&amp;amp;sc
riptonly=yes&quot;&gt;&lt;/script&gt;
      &lt;script type=&quot;text/javascript&quot; src=&quot;http://pagead2.googlesyndication.com/p
agead/show_ads.js&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div id=&quot;sidebar&quot;&gt;
    &lt;div id=&quot;adblock&quot;&gt;
      &lt;h2&gt;Advertisements&lt;/h2&gt;
      &lt;div id=&quot;buttonad&quot;&gt;
        &lt;script type=&quot;text/javascript&quot; src=&quot;/include/advert.php?type=block&amp;amp;s
criptonly=yes&quot;&gt;&lt;/script&gt;
</code></pre>
<p>Was kann ich da denn jetzt machen?<br />
Ich empfange das so:</p>
<pre><code class="language-cpp">amountRecieved = recv( mySocket, cMsg, 500000, 0 );
</code></pre>
<p>Danke schonmal für eure Tatenkräftige Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1212561</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1212561</guid><dc:creator><![CDATA[Listing]]></dc:creator><pubDate>Fri, 19 Jan 2007 11:04:52 GMT</pubDate></item><item><title><![CDATA[Reply to PHP Server Sendet Werbung on Fri, 19 Jan 2007 12:45:03 GMT]]></title><description><![CDATA[<p>Frag dich, warum dein Programm mit dem Werbebanner nicht klar kommt. Ich würde es so machen, dass ich die Daten erst nach dem Empfang auswerte und nicht schon während des Empfangs. Dann kann ankommen was will und die Fehlerbehandlung kannst du dann in die spätere Auswertung verlagern.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1212621</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1212621</guid><dc:creator><![CDATA[[[global:former_user]]]]></dc:creator><pubDate>Fri, 19 Jan 2007 12:45:03 GMT</pubDate></item><item><title><![CDATA[Reply to PHP Server Sendet Werbung on Fri, 19 Jan 2007 13:08:25 GMT]]></title><description><![CDATA[<p>Luckie schrieb:</p>
<blockquote>
<p>Frag dich, warum dein Programm mit dem Werbebanner nicht klar kommt. Ich würde es so machen, dass ich die Daten erst nach dem Empfang auswerte und nicht schon während des Empfangs. Dann kann ankommen was will und die Fehlerbehandlung kannst du dann in die spätere Auswertung verlagern.</p>
</blockquote>
<p>Ich werte ja nach dem Empfang aus:</p>
<pre><code class="language-cpp">lOk = ( send( mySock, cMsg, strlen( cMsg ), 0 ) &gt;= 0 );
		   if ( lOk )
		   {
			   ZeroMemory(cMsg, 500000);
               amountRecieved = recv( mySock, cMsg, 500000, 0 );
		   }
		   closesocket( mySock );
		}

       // Close Winsock
       WSACleanup();
//Hier kommt iergendwo meine Auswertung, alles ist schon Empfangen
   }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1212631</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1212631</guid><dc:creator><![CDATA[Listing]]></dc:creator><pubDate>Fri, 19 Jan 2007 13:08:25 GMT</pubDate></item><item><title><![CDATA[Reply to PHP Server Sendet Werbung on Fri, 19 Jan 2007 13:22:16 GMT]]></title><description><![CDATA[<p>Hat zwar wahrscheinlich nichts mit dem Problem zu tun, aber einmal recv aufrufen ist einfach falsch. Da kann auch nur ein 1 Byte kommen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1212641</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1212641</guid><dc:creator><![CDATA[recv]]></dc:creator><pubDate>Fri, 19 Jan 2007 13:22:16 GMT</pubDate></item><item><title><![CDATA[Reply to PHP Server Sendet Werbung on Fri, 19 Jan 2007 13:40:17 GMT]]></title><description><![CDATA[<p>recv schrieb:</p>
<blockquote>
<p>Hat zwar wahrscheinlich nichts mit dem Problem zu tun, aber einmal recv aufrufen ist einfach falsch. Da kann auch nur ein 1 Byte kommen.</p>
</blockquote>
<p>Und was is dann bitte richtig -.-</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1212655</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1212655</guid><dc:creator><![CDATA[Listing]]></dc:creator><pubDate>Fri, 19 Jan 2007 13:40:17 GMT</pubDate></item><item><title><![CDATA[Reply to PHP Server Sendet Werbung on Fri, 19 Jan 2007 14:01:20 GMT]]></title><description><![CDATA[<p>Im Ernstfall: So lange immer stückchenweise recv() aufrufen, bis der meldet, daß keine Daten mehr kommen.</p>
<pre><code class="language-cpp">int recv_all(int sock,void* buf,int max_len)
{
  char* cbuf=buf;
  int datalen=0;
  int blocklen;
  while((datalen&lt;max_len)&amp;&amp;((blocklen=recv(sock,cbuf+datalen,max_len-datalen,0))!=0))
    datalen+=blocklen;
  return datalen;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1212673</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1212673</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Fri, 19 Jan 2007 14:01:20 GMT</pubDate></item><item><title><![CDATA[Reply to PHP Server Sendet Werbung on Fri, 19 Jan 2007 14:09:35 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#define MAX 500000

char cMsg[MAX]; // dein request da rein ?
bool 10k = false;
unsigned amountReceivedTotal = 0;
unsigned amountReceived = TRUE;

lOk = (send( mySock, cMsg, strlen( cMsg ), 0 ) &gt;= 0 );
if(10k) {
while(amountReceived &amp;&amp; amountReceivedTotal += (amountReceived = recv( mySock, cMsg + amountReceivedTotal, MAX - amountReceivedTotal, 0 ));
}
cMsg[amountReceivedTotal] = 0; // serverantwort nun drinnen

closesocket( mySock );
</code></pre>
<p>war wohl wer schneller <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1212674</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1212674</guid><dc:creator><![CDATA[DaRpH]]></dc:creator><pubDate>Fri, 19 Jan 2007 14:09:35 GMT</pubDate></item><item><title><![CDATA[Reply to PHP Server Sendet Werbung on Fri, 19 Jan 2007 14:59:51 GMT]]></title><description><![CDATA[<p>DaRpH schrieb:</p>
<blockquote>
<pre><code class="language-cpp">#define MAX 500000

char cMsg[MAX]; // dein request da rein ?
bool 10k = false;
unsigned amountReceivedTotal = 0;
unsigned amountReceived = TRUE;

lOk = (send( mySock, cMsg, strlen( cMsg ), 0 ) &gt;= 0 );
if(10k) {
while(amountReceived &amp;&amp; amountReceivedTotal += (amountReceived = recv( mySock, cMsg + amountReceivedTotal, MAX - amountReceivedTotal, 0 ));
}
cMsg[amountReceivedTotal] = 0; // serverantwort nun drinnen

closesocket( mySock );
</code></pre>
<p>war wohl wer schneller <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
</blockquote>
<p>Dein Code ist Gold wert!</p>
<p>Unendlicher Dank von mir <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p>An dem Problem hab ich so lange gearbeitet und endlich geht es<br />
nun, mir hast du den Tag gerettet ^^,<br />
das gleiche gilt natürlich auch für CStoll</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1212701</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1212701</guid><dc:creator><![CDATA[Listing]]></dc:creator><pubDate>Fri, 19 Jan 2007 14:59:51 GMT</pubDate></item></channel></rss>