Jump to content

ohrstedtl

Members
  • Posts

    12
  • Joined

  • Last visited

ohrstedtl's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. I have summed up my finnigs. Scenario. I have a file on my local disk, soap.html. When I open the file it will be shown in the web browser, and a button on the webpage allow it to get the exchange rates from the national bank. If I click on the button I will receive data every time into the webpage. If I open the file within my local web server ( MAMP Pro ), the file again will be shown in the web browser. If I now click the button, no data will be received. If I copy the file to my domain server and open it from there, it will give the same result, no data received. I sent the file to W3Schools forum for investigation, and the replay was that they did not get any data either. I downloaded my previous uploaded file ( which was a copy from my still working soap.html and called it soapcopy.html ) from W3Schools and opened it on my local disk the same way I did with my original file, and to my surprise it did not work, the same as it was for W3Schools forum. I made a local copy of the file, and that did not work either. I made a check if the files were equal the original working one, using the command "diff -s soap.html soapcopy.html" and they were equal. Now I took the contents of the downloaded file (soapcopy.html) and created a new file with this content, and called it soapnew.html, opened it from the local disk, and it works, data is received. But if I open this new file ( soapnew.html ) with MAMP Pro ,it do not work, no data. This is the same as for the original file soap.html when it is opened from MAMP Pro. I used now a packet analyzer ( WireShark ) to see what is sent to the server at the national bank, using the working ( soap.html ) and not working files ( soapcopy.html ), opened from local disk. There I found that every time when the soapcopy.html file was sent there was a flag ( push ) set in the TCP part of the packet, and this flag was not set in the soap.html file packets. The payload on the soapcopy.html files starts with “OPTIONS” while the payload starts with “POST” on the soap.html file packets. When I opened the file, soap.html, from the local web server ( MAMP Pro ), or I opened soap.html from my web domain, the packet have the push flag set and the payload starts with “OPTIONS”. As stated before under these condition I will not receive any data. I cannot understand why the same code will produce so different packets depending on where the file is opened from.
  2. Hello again, I have looked at the captured packets and find that when I do not get any data, the push flagg is set in TCP, and the payload start with OPTIONS instead of POST for the packets that get data. I am very confused since the files I use for this are identical, but one get data, and the other one not.
  3. Hello again, I could not attach the file called paketen.pcap, how can I do to get the file to yoy?
  4. Hello again! I have been thinking how you could get the result you got, as I send you the same file I get data to when using it from my local computer. I downloaded the file I uploaded to you and tested it. It gives the same result as you, no data. So I compared the two filés and they were equal. Confusing! So I used WireShark to capture the packets from the two filés, and there is a differens between how the packet looks.. I attach the captured packets so If you want to you can see how it look like.
  5. Thanks for your answer, I will contact the server administrator to find out what to do.
  6. I have a html page which give me different result depending on from where I start the page. If I start the page by clicking on the file on my local disk in Finder ( I use an iMac computer) then I will get response with data from the webservices I want to use. But if I start the html page from my domainserver, I will NOT get any data from the webservices. The html page do not start to contact the webservices at load time, I need to click i button "get exchanges"to start the process. The adress to the page on my domain is : http://diadoker.se/omvandla/soap.html. Attached is the html file itself. I don't understand why it do not work from the server as it is the same code that is executed to access the the webservices. soap.html
  7. Hello again Here is the response taken from wireshark: Hypertext Transfer Protocol HTTP/1.1 500 Internal Server Errorrn [Expert Info (Chat/Sequence): HTTP/1.1 500 Internal Server Errorrn] [Message: HTTP/1.1 500 Internal Server Errorrn] [severity level: Chat] [Group: Sequence] Request Version: HTTP/1.1 Status Code: 500 Response Phrase: Internal Server Error Date: Wed, 19 Mar 2014 10:11:50 GMTrn Server: Apachern Content-Length: 528rn [Content length: 528] Connection: closern Content-Type: text/html; charset=iso-8859-1rn rn [HTTP response 1/1] [Time since request: 0.051121000 seconds] [Request in frame: 10] Line-based text data: text/html <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">n <html><head>n <title>500 Internal Server Error</title>n </head><body>n <h1>Internal Server Error</h1>n <p>The server encountered an internal error orn misconfiguration and was unable to completen your request.</p>n <p>Please contact the server administrator at n you@example.com to inform them of the time this error occurred,n and the actions you performed just before this error.</p>n <p>More information about this error may be availablen in the server error log.</p>n </body></html>n 0000 c8 bc c8 be e9 ea 08 60 6e 21 b7 28 08 00 45 00 .......`n!.(..E. 0010 02 f4 40 80 40 00 31 06 53 0e c2 0e cd 24 c0 a8 ..@.@.1.S....$.. 0020 63 9a 00 50 d0 d4 08 9c 38 a6 de c4 02 f8 80 18 c..P....8....... 0030 fb b4 cd 4b 00 00 01 01 08 0a 43 67 df 3c 01 69 ...K......Cg.<.i 0040 ff a9 48 54 54 50 2f 31 2e 31 20 35 30 30 20 49 ..HTTP/1.1 500 I 0050 6e 74 65 72 6e 61 6c 20 53 65 72 76 65 72 20 45 nternal Server E 0060 72 72 6f 72 0d 0a 44 61 74 65 3a 20 57 65 64 2c rror..Date: Wed, 0070 20 31 39 20 4d 61 72 20 32 30 31 34 20 31 30 3a 19 Mar 2014 10: 0080 31 31 3a 35 30 20 47 4d 54 0d 0a 53 65 72 76 65 11:50 GMT..Serve 0090 72 3a 20 41 70 61 63 68 65 0d 0a 43 6f 6e 74 65 r: Apache..Conte 00a0 6e 74 2d 4c 65 6e 67 74 68 3a 20 35 32 38 0d 0a nt-Length: 528.. 00b0 43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 63 6c 6f 73 Connection: clos 00c0 65 0d 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a e..Content-Type: 00d0 20 74 65 78 74 2f 68 74 6d 6c 3b 20 63 68 61 72 text/html; char 00e0 73 65 74 3d 69 73 6f 2d 38 38 35 39 2d 31 0d 0a set=iso-8859-1.. 00f0 0d 0a 3c 21 44 4f 43 54 59 50 45 20 48 54 4d 4c ..<!DOCTYPE HTML 0100 20 50 55 42 4c 49 43 20 22 2d 2f 2f 49 45 54 46 PUBLIC "-//IETF 0110 2f 2f 44 54 44 20 48 54 4d 4c 20 32 2e 30 2f 2f //DTD HTML 2.0// 0120 45 4e 22 3e 0a 3c 68 74 6d 6c 3e 3c 68 65 61 64 EN">.<html><head 0130 3e 0a 3c 74 69 74 6c 65 3e 35 30 30 20 49 6e 74 >.<title>500 Int 0140 65 72 6e 61 6c 20 53 65 72 76 65 72 20 45 72 72 ernal Server Err 0150 6f 72 3c 2f 74 69 74 6c 65 3e 0a 3c 2f 68 65 61 or</title>.</hea 0160 64 3e 3c 62 6f 64 79 3e 0a 3c 68 31 3e 49 6e 74 d><body>.<h1>Int 0170 65 72 6e 61 6c 20 53 65 72 76 65 72 20 45 72 72 ernal Server Err 0180 6f 72 3c 2f 68 31 3e 0a 3c 70 3e 54 68 65 20 73 or</h1>.<p>The s 0190 65 72 76 65 72 20 65 6e 63 6f 75 6e 74 65 72 65 erver encountere 01a0 64 20 61 6e 20 69 6e 74 65 72 6e 61 6c 20 65 72 d an internal er 01b0 72 6f 72 20 6f 72 0a 6d 69 73 63 6f 6e 66 69 67 ror or.misconfig 01c0 75 72 61 74 69 6f 6e 20 61 6e 64 20 77 61 73 20 uration and was 01d0 75 6e 61 62 6c 65 20 74 6f 20 63 6f 6d 70 6c 65 unable to comple 01e0 74 65 0a 79 6f 75 72 20 72 65 71 75 65 73 74 2e te.your request. 01f0 3c 2f 70 3e 0a 3c 70 3e 50 6c 65 61 73 65 20 63 </p>.<p>Please c 0200 6f 6e 74 61 63 74 20 74 68 65 20 73 65 72 76 65 ontact the serve 0210 72 20 61 64 6d 69 6e 69 73 74 72 61 74 6f 72 20 r administrator 0220 61 74 20 0a 20 79 6f 75 40 65 78 61 6d 70 6c 65 at . you@example 0230 2e 63 6f 6d 20 74 6f 20 69 6e 66 6f 72 6d 20 74 .com to inform t 0240 68 65 6d 20 6f 66 20 74 68 65 20 74 69 6d 65 20 hem of the time 0250 74 68 69 73 20 65 72 72 6f 72 20 6f 63 63 75 72 this error occur 0260 72 65 64 2c 0a 20 61 6e 64 20 74 68 65 20 61 63 red,. and the ac 0270 74 69 6f 6e 73 20 79 6f 75 20 70 65 72 66 6f 72 tions you perfor 0280 6d 65 64 20 6a 75 73 74 20 62 65 66 6f 72 65 20 med just before 0290 74 68 69 73 20 65 72 72 6f 72 2e 3c 2f 70 3e 0a this error.</p>. 02a0 3c 70 3e 4d 6f 72 65 20 69 6e 66 6f 72 6d 61 74 <p>More informat 02b0 69 6f 6e 20 61 62 6f 75 74 20 74 68 69 73 20 65 ion about this e 02c0 72 72 6f 72 20 6d 61 79 20 62 65 20 61 76 61 69 rror may be avai 02d0 6c 61 62 6c 65 0a 69 6e 20 74 68 65 20 73 65 72 lable.in the ser 02e0 76 65 72 20 65 72 72 6f 72 20 6c 6f 67 2e 3c 2f ver error log.</ 02f0 70 3e 0a 3c 2f 62 6f 64 79 3e 3c 2f 68 74 6d 6c p>.</body></html 0300 3e 0a >. THope this gives you a clou what is wrong.
  8. Hello I want to get data from a webservices and use file_get_contents() to send the request to the server. When I used WireShark to look at what is sent I found that the url is stripped. Here is the output from WireShark for the first block: POST /sweaWS/services/SweaWebServiceHttpSoap12Endpoint HTTP/1.0 Accept-Encoding:gzip,deflate Content-type:application/soap+xml;charset=UTF-8;action='urn:getLatestInterestAndExchangeRates' Content-Length:2881 Host:swea.riksbank.se:80 Connection:Keep-Alive User-Agent:Apache-HttpClient/4.1.1 (java 1.5) <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://swea.riksbank.se/xsd"><soap:Header/><soap:Body><xsd:getLatestInterestAndExchangeRates><languageid>sv</languageid><seriesid>SEKATSPMI</seriesid> <!--Österrike, shilling--><seriesid>SEKAUDPMI</seriesid> <!--Australien, dollar --><seriesid>SEKBEFPMI</seriesid> <!--Belgien, franc --><seriesid>SEKBRLPMI</seriesid> <!--Brasilien, real --><seriesid>SEKCADPMI</seriesid> <!--Canada, dollar --><seriesid>SEKCHFPMI</seriesid> <!--Schweiz, franc --><seriesid>SEKCNYPMI</seriesid> <!--Kina, yuan renminbi --><seriesid>SEKCYPPMI</seriesid> <!--Cypern, pund --><seriesid>SEKCZKPMI</seriesid> <!--Tjeckien, kronor --><seriesid>SEKDEMPMI</seriesid> <!--Tyskland, mark --><seriesid>SEKDKKPMI</seriesid> <!--Danmark, kronor --><seriesid>SEKEEKPMI</seriesid> <!--Estland, kronor --><seriesid>SEKESPPMI</seriesid> <!--Spanien, pesetas --><seriesid>SEKEURPMI</seriesid> <!--Euroland, euro --><seriesid>SEKFIMPMI</seriesid> <!--Finland, mark --><seriesid>SEKFRFPMI</seriesid> <!--Frankrike, franc --><seriesid>SEKGBPPMI</seriesid> <!--Storbritannien, pund --><seriesid>SEKGRDPM So I wonder if I do the write thing or are missing something in my code. I run a program (MAMP PRO) locally to do the tests so I can use WireShark to look at the communication. Attached is the php file I used. soap1.php
  9. Hello, I want to get data from a webservices by using file_get_contents, but I have a problem since the url is not sent as I have written it. The following code is used: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="sv" xml:lang="sv"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="description" content="" /> <meta name="keywords" content="" /> <meta name="author" content="Lennart Öhrstedt" /> <meta name="Copyright" content="Diadoker" /> <meta name="Company" content="Diadoker" /> <meta http-equiv="Language" content="Sv" /> <meta name="Robots" content="index,follow" /> <meta lang="Sv" /> <link rel="canonical" href="http://www.diadoker.se" /> </head> <body> <?php $url = 'http://swea.riksbank.se:80/sweaWS/services/SweaWebServiceHttpSoap12Endpoint'; $request = '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://swea.riksbank.se/xsd">' .'<soap:Header/>' .'<soap:Body>' .'<xsd:getLatestInterestAndExchangeRates>' .'<languageid>sv</languageid>' .'<seriesid>SEKATSPMI</seriesid> <!--Österrike, shilling-->' .'<seriesid>SEKAUDPMI</seriesid> <!--Australien, dollar -->' .'<seriesid>SEKBEFPMI</seriesid> <!--Belgien, franc -->' .'<seriesid>SEKBRLPMI</seriesid> <!--Brasilien, real -->' .'<seriesid>SEKCADPMI</seriesid> <!--Canada, dollar -->' .'<seriesid>SEKCHFPMI</seriesid> <!--Schweiz, franc -->' .'<seriesid>SEKCNYPMI</seriesid> <!--Kina, yuan renminbi -->' .'<seriesid>SEKCYPPMI</seriesid> <!--Cypern, pund -->' .'<seriesid>SEKCZKPMI</seriesid> <!--Tjeckien, kronor -->' .'<seriesid>SEKDEMPMI</seriesid> <!--Tyskland, mark -->' .'<seriesid>SEKDKKPMI</seriesid> <!--Danmark, kronor -->' .'<seriesid>SEKEEKPMI</seriesid> <!--Estland, kronor -->' .'<seriesid>SEKESPPMI</seriesid> <!--Spanien, pesetas -->' .'<seriesid>SEKEURPMI</seriesid> <!--Euroland, euro -->' .'<seriesid>SEKFIMPMI</seriesid> <!--Finland, mark -->' .'<seriesid>SEKFRFPMI</seriesid> <!--Frankrike, franc -->' .'<seriesid>SEKGBPPMI</seriesid> <!--Storbritannien, pund -->' .'<seriesid>SEKGRDPMI</seriesid> <!--Grekland, drachmer -->' .'<seriesid>SEKHKDPMI</seriesid> <!--Hong Kong, dollar -->' .'<seriesid>SEKHUFPMI</seriesid> <!--Ungern, forint -->' .'<seriesid>SEKIDRPMI</seriesid> <!--Indonesien, rupee -->' .'<seriesid>SEKIEPPMI</seriesid> <!--Irland, pund -->' .'<seriesid>SEKINRPMI</seriesid> <!--Indien, rupee -->' .'<seriesid>SEKISKPMI</seriesid> <!--Island, kronor -->' .'<seriesid>SEKITLPMI</seriesid> <!--Italien, lire -->' .'<seriesid>SEKJPYPMI</seriesid> <!--Japan, yen -->' .'<seriesid>SEKKRWPMI</seriesid> <!--Syd Korea, won -->' .'<seriesid>SEKKWDPMI</seriesid> <!--Kuwait, dinar -->' .'<seriesid>SEKLTLPMI</seriesid> <!--Litauen, litas -->' .'<seriesid>SEKLVLPMI</seriesid> <!--Lettland, lav -->' .'<seriesid>SEKMADPMI</seriesid> <!--Marocko, dirham -->' .'<seriesid>SEKMXNPMI</seriesid> <!--Mexiko, nuevo peso -->' .'<seriesid>SEKMYRPMI</seriesid> <!--Malaysia, ringitt -->' .'<seriesid>SEKNLGPMI</seriesid> <!--Nederländerna, gulden -->' .'<seriesid>SEKNOKPMI</seriesid> <!--Norge, kronor -->' .'<seriesid>SEKNZDPMI</seriesid> <!--Nya Zeeland, dollar -->' .'<seriesid>SEKPLNPMI</seriesid> <!--Polen, zloty -->' .'<seriesid>SEKPTEPMI</seriesid> <!--Portugal, escudo -->' .'<seriesid>SEKRUBPMI</seriesid> <!--Ryssland, rubel -->' .'<seriesid>SEKSARPMI</seriesid> <!--Saudiarabien, riyal -->' .'<seriesid>SEKSGDPMI</seriesid> <!--Singapore, dollar -->' .'<seriesid>SEKSITPMI</seriesid> <!--Slovenien, tolar -->' .'<seriesid>SEKSKKPMI</seriesid> <!--Slovakien, koruna -->' .'<seriesid>SEKTHBPMI</seriesid> <!--Thailand, baht -->' .'<seriesid>SEKTRLPMI</seriesid> <!--Turkiet, lira -->' .'<seriesid>SEKTRYPMI</seriesid> <!--Turkiet, ny lira -->' .'<seriesid>SEKUSDPMI</seriesid> <!--Förenta Staterna, dollar -->' .'<seriesid>SEKZARPMI</seriesid> <!--Sydafrika, rand -->' .'</xsd:getLatestInterestAndExchangeRates>' .'</soap:Body>' .'</soap:Envelope>'; function alerten($texten) { echo "<script type='text/javascript' language='JavaScript'>alert('$texten');</script>"; } function do_post_request( $url, $query_string ) { $params = array('http'=> array('method'=>'POST','header'=>"Accept-Encoding:gzip,deflate"."r"."Content-Type:application/soap+xml;charset=UTF-8;action='urn:getLatestInterestAndExchangeRates'"."r".'Content-Length:'.strlen($query_string)."r"."Host:swea.riksbank.se:80"."r". "Connection:Keep-Alive"."r"."User-Agent:Apache-HttpClient/4.1.1 (java 1.5)"."rn", 'content' => $query_string) ); $context = stream_context_create( $params ); $contents = file_get_contents( $url, FALSE, $context );//alerten($contents); return $contents; } $response = do_post_request($url, $request); //alerten($response); ?> <div id="fot"> <table id="fotTabell" width="100%" summary="Copyright"> <tr> <td align="center"> <span> Copyright © <span id="år"> 2014 </span> Diadoker. All rights reserved. </span><br /> <a href="mailto:lennart.ohrstedt@diadoker.se" style="color: black"> lennart.ohrstedt@diadoker.se </a><br /> <a href="http://www.diadoker.se/" style="color: black"> www.diadoker.se </a> <br /> </td> </tr> </table> </div> </body> </html> When I use WireShark to look at what is sent I found this for the first block: POST /sweaWS/services/SweaWebServiceHttpSoap12Endpoint HTTP/1.0 Accept-Encoding:gzip,deflate Content-type:application/soap+xml;charset=UTF-8;action='urn:getLatestInterestAndExchangeRates' Content-Length:2881 Host:swea.riksbank.se:80 Connection:Keep-Alive User-Agent:Apache-HttpClient/4.1.1 (java 1.5) <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://swea.riksbank.se/xsd"><soap:Header/><soap:Body><xsd:getLatestInterestAndExchangeRates><languageid>sv</languageid><seriesid>SEKATSPMI</seriesid> <!--Österrike, shilling--><seriesid>SEKAUDPMI</seriesid> <!--Australien, dollar --><seriesid>SEKBEFPMI</seriesid> <!--Belgien, franc --><seriesid>SEKBRLPMI</seriesid> <!--Brasilien, real --><seriesid>SEKCADPMI</seriesid> <!--Canada, dollar --><seriesid>SEKCHFPMI</seriesid> <!--Schweiz, franc --><seriesid>SEKCNYPMI</seriesid> <!--Kina, yuan renminbi --><seriesid>SEKCYPPMI</seriesid> <!--Cypern, pund --><seriesid>SEKCZKPMI</seriesid> <!--Tjeckien, kronor --><seriesid>SEKDEMPMI</seriesid> <!--Tyskland, mark --><seriesid>SEKDKKPMI</seriesid> <!--Danmark, kronor --><seriesid>SEKEEKPMI</seriesid> <!--Estland, kronor --><seriesid>SEKESPPMI</seriesid> <!--Spanien, pesetas --><seriesid>SEKEURPMI</seriesid> <!--Euroland, euro --><seriesid>SEKFIMPMI</seriesid> <!--Finland, mark --><seriesid>SEKFRFPMI</seriesid> <!--Frankrike, franc --><seriesid>SEKGBPPMI</seriesid> <!--Storbritannien, pund --><seriesid>SEKGRDPM After POST I expected to see my full url as in $url. So I wonder if I have missed something in my code, or I need to use some other procedure. I send the file as well, named soap1.php. soap1.php
  10. OK. thanks for your explanation. I will take learning from this.
  11. I was myself wundering if the webpage was accessed 2 times to explain the double count, thats why I used the adding code with an alert to check whether this was the fact, because if so then I should see 2 alert-windows, but I only see one, so can you explain this as well?.
  12. I have encountered a strange error on a webpage using a textfile as a counter of visits on the page. Here is the code for a testpage: <code> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!--created by Lennart Öhrstedt, Diadoker--> <html xmlns="http://www.w3.org/1999/xhtml"> <head> </head> <?php if (!file_exists("test.txt")) { $file=fopen("test.txt", "w"); fclose($file);} $file=fopen("test.txt", "r+"); while(!feof($file)) { $count=fgets($file)+1;} fclose($file); ?> <body> <img src="#" alt="test" height="100"> </body> </html> </code> With this code the count in the file "test.txt" is +2 insted of +1, if I change the src on the img-tag to anything other than #( src="#") like an A( src="A"), it counts correct. To check it out I added this code before ?> in the php section: <code> function alerten($texten) { echo "<script type='text/javascript' language='JavaScript'>alert('$texten');</script>";} $file=fopen("test.txt", "r+"); $count=fgets($file); fclose($file); alerten($count); </code> then the alert shows a correct count, after I clicked on the OK in the alert popup and look in the "test.txt" file the count is +1. The html tag <img> cannot access any file on the server, so this is a mystery for me. Is there an explanation for this behavior?
×
×
  • Create New...