Changeset 7816 for sandbox


Ignore:
Timestamp:
01/30/13 18:34:23 (11 years ago)
Author:
alexandrecorreia
Message:

Ticket #2507 - Ajustando o help da página index.html

Location:
sandbox/webservice/restclient_new
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sandbox/webservice/restclient_new/css/styles.css

    r7808 r7816  
    2525#content h3 
    2626{ 
    27         font-size : 11; 
     27        font-size : 11pt; 
    2828        font-weight : bold; 
    2929} 
     
    4545} 
    4646 
    47 #resources p  
     47#exemplos_uso 
    4848{ 
    49         font-size : 12pt; 
     49        font-size : 11pt; 
     50        text-align: justify; 
     51} 
     52#exemplos_uso a 
     53{ 
     54        color: red; 
     55        font-size: 12pt; 
     56        font-weight: bold; 
     57        text-decoration: none; 
     58} 
     59 
     60#links_rel 
     61{ 
     62        font-size : 11pt; 
     63        text-align: justify; 
     64} 
     65 
     66#resources p 
     67{ 
     68        font-size : 11pt; 
    5069} 
    5170 
  • sandbox/webservice/restclient_new/index.html

    r7808 r7816  
    124124                        <div id="exemplos_uso">  
    125125 
    126                                 <p></p> 
     126                                <p> 
     127                                        Um exemplo de c&oacute;digo de uma chamada AJAX, utilizando a Jquery. Este trecho de c&oacute;digo abaixo representa 
     128                                        uma chamada para o Resource ExpressoVersion.  
     129                                </p> 
     130 
     131                                <p>      
     132                                        Este m&eacute;todo retorna a vers&atilde;o do Expresso. Veja este exemplo funcionando em sua m&aacute;quina baixando este projeto <a href="javascript:alert('Criar projeto')">PROJETO.ZIP</a>. 
     133                                </p> 
     134 
     135                                <p> 
     136                                        <h3>Enviando as informa&ccedil;&otilde;es com Javascript</h3> 
     137 
     138                                        <pre class='prettyprint'> 
     139                        $.ajax( 
     140                        { 
     141                            type        : "POST", 
     142                            url         : "client_rest.php", 
     143                            data        : 
     144                            { 
     145                                params          : {}, 
     146                                serverUrl       : "http://expresso.pr.gov.br/api/rest/ExpressoVersion", 
     147                                methodType      : "POST" 
     148                            }, 
     149                            beforeSend: function() 
     150                            { 
     151                                // Coloque aqui seu c&oacute;digo; 
     152                            }, 
     153                            success: function(response)                          
     154                            { 
     155                                //Coloque aqui seu c&oacute;digo; 
     156                            }, 
     157                            error: function(response) 
     158                            { 
     159                                //Coloque aqui seu c&oacute;digo; 
     160                            } 
     161                        }; 
     162                    </pre> 
     163 
     164                                </p> 
     165 
     166                                <p> 
     167                                        <h3>Recebendo as informa&ccedil;&otilde;es no PHP</h3> 
     168 
     169                                        <pre class='prettyprint'> 
     170                        &lt;?php 
     171 
     172                            $serverUrl  = $_REQUEST['serverUrl']; 
     173                            $methodType = $_REQUEST['methodType']; 
     174                            $params     = $_REQUEST['params']; 
     175                            $id         = ( $_REQUEST['id'] ) ? $_REQUEST['id'] : time(); 
     176                             
     177                            $data = "id=".$id."&amp;params=" . stripslashes($params); 
     178 
     179                            function callJSONRPC($url, $data, $method) 
     180                            { 
     181                                $ch = curl_init(); 
     182                                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
     183                                 
     184                                if($method == "POST"){ 
     185                                    curl_setopt($ch, CURLOPT_POST, 1); 
     186                                    curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 
     187                                } 
     188                                 
     189                                curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
     190                                curl_setopt($ch, CURLOPT_URL, $url); 
     191                                curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/x-www-form-urlencoded")); 
     192                                 
     193                                $result     = curl_exec($ch); 
     194                                $errorCode  = curl_getinfo($ch,CURLINFO_HTTP_CODE); 
     195                                $lastURL    = curl_getinfo($ch,CURLINFO_EFFECTIVE_URL); 
     196                                 
     197                                curl_close($ch); 
     198                                 
     199                                switch($errorCode) 
     200                                { 
     201                                    case 200: 
     202                                        break; 
     203 
     204                                    case 404: 
     205                                        $result = json_encode(array("error" => array("code" => 404, "message" => "RECURSO NAO ENCONTRADO => $lastURL"))); 
     206                                        break; 
     207                                 
     208                                    case 500: 
     209                                        $result = json_encode(array("error" => array("code" => 500, "message" => "ERRO INTERNO. CONSULTE O LOG DO SERVIDOR"))); 
     210                                        break; 
     211                                     
     212                                    default: 
     213                                        $result = json_encode(array("error" => array("code" => -1, "message" => "ERRO DESCONHECIDO. CONSULTE O LOG DO SERVIDOR"))); 
     214                                        break; 
     215                                } 
     216                                 
     217                                return $result; 
     218                            } 
     219 
     220                            $result = callJSONRPC($serverUrl, $data, $methodType); 
     221 
     222                            echo $result; 
     223                        ?&gt; 
     224 
     225                    </pre> 
     226 
     227                                </p> 
    127228 
    128229                        </div> 
     
    140241                                        <li><a href='http://en.wikipedia.org/wiki/JSON-RPC#Implementations'>JSON-RPC Implementations</a></li> 
    141242                                </ul> 
     243 
     244                                <p>Bibliotecas JavaScript Utilizadas</p> 
     245 
     246                                <ul> 
     247                                        <li><a href='http://www.jquery.com'>JQuery-CORE</a></li> 
     248                                        <li><a href='http://www.jqueryui.com'>JQuery-UI</a></li> 
     249                                        <li><a href='http://http://embeddedjs.com'>EJS</a></li> 
     250                                </ul> 
     251 
     252                                <p>Linguagem de programa&ccedil;&atilde;o Server Side</p> 
     253                                <ul> 
     254                                        <li><a href='http://www.php.net'>PHP</a></li> 
     255                                </ul> 
     256 
     257                                <p>Servidor WEB</p> 
     258                                <ul> 
     259                                        <li><a href='http://www.apache.org'>Apache</a></li> 
     260                                </ul> 
     261 
    142262                        </div> 
    143263 
  • sandbox/webservice/restclient_new/js/functions.js

    r7808 r7816  
    1515                        $("#content_2").accordion( { collapsible: true } ); 
    1616 
     17                        prettyPrint(); 
    1718                }) 
    1819        } 
Note: See TracChangeset for help on using the changeset viewer.