Interesting links

  • This is a pastebin like place where I put stuff I find useful

 

Refreshing a div from with fade in:

Code: [Select]<script type=”text/javascript”>
$(document).ready(function() {
$(“#responsecontainer”).fadeOut(“fast”).load(“getrows.php”).fadeIn(“slow”);
var refreshId = setInterval(function() {
$(“#responsecontainer”).fadeOut(“fast”).load(‘getrows.php’).fadeIn(“slow”);
}, 5000);
$.ajaxSetup({ cache: false });

[Code]…

  • snippet 2:

‚Äč

Posting to a form from php

  • posting to a form from php http://www.html-form-guide.com/php-form/php-form-submit.html
  • I also have this code i used before successfully:
  • //$output2=HTTP_Post(“http://www.server2.com/script2.php”,$_POST);
     
          function HTTP_Post($URL,$data, $referrer=””) {
    $request=””;
    $result=””;
            // parsing the given URL
            $URL_Info=parse_url($URL);
     
            // Building referrer
            if($referrer==””) // if not given use this script as referrer
              $referrer=$_SERVER[“SCRIPT_URI”];
     
            // making string from $data 
            foreach($data as $key=>$value)
            {
     $values[]=”$key=”.urlencode($value);
    //   print “$key :: $value\n”;
            }
    $data_string=implode(“&”,$values);
          
            // Find out which port is needed – if not given use standard (=80)
            if(!isset($URL_Info[“port”]))
              $URL_Info[“port”]=80;
      
            // building POST-request:
            $request.=”POST “.$URL_Info[“path”].” HTTP/1.1\r\n”;
            $request.=”Host: “.$URL_Info[“host”].”\r\n”;
            $request.=”Referer: $referrer\r\n”;
    $request.=”Accept-language: en\r\nCookie: “. “ASPSESSIONIDQATBADCS=HINAJNDBFJMLOJFHPLHPCDOE”.”\r\n” .
       “User-Agent: Mozilla 4.0\r\n” . 
             “Content-type: application/x-www-form-urlencoded\r\n” . 
             “Content-length: “.strlen($data_string).”\r\n”;
            $request.=”Connection: close\r\n”;
            $request.=”\r\n”;
            $request.=$data_string.”\r\n”;
     
     
            $fp = fsockopen($URL_Info[“host”],$URL_Info[“port”]);
            fputs($fp, $request);
            while(!feof($fp)) {
                $result .= fgets($fp, 128);
            }
            fclose($fp);
     
            return $result;
          }

 

Leave a Reply

Your email address will not be published. Required fields are marked *