vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   ajax help pease (https://vborg.vbsupport.ru/showthread.php?t=234490)

wolfe 01-29-2010 06:02 PM

ajax help pease
 
i need help with this code if theres any Ajax coders on here this is my grabbing script with grabs the content without a page refresh. it was working a charm on vB3 but since i updated to vB4 its not working something to do with it not working on XHTML can anyone help me out PLEASE need to get it back up urgent

Template Code:

HTML Code:

<script type="text/javascript">

    function ax()
    {
        if(document.getElementById('btnS').value=="Fill")
        {
            document.getElementById('txtTitle').value        =    "";
            document.getElementById('image').value        =    "";
            document.getElementById('infolink').value        =    "";
            document.getElementById('summary').value        =    "";
           
            axtitle();
            aximg();
                        axlink();
            axdesc();           
        }
    }

    function axtitle()
    {
        var uri    =    document.getElementById('url').value;

        var xt = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
        if (xt)
        {
            xt.onreadystatechange = function()
            {
                if (xt.readyState == 4 && xt.status == 200)
                {
                    document.getElementById('txtTitle').value= xt.responseText;
                    document.getElementById('btnS').value="Fill"
                }
            }
            document.getElementById('btnS').value="Filling...";
            xt.open("POST", "getinfo.php?purl="+uri+"&preq=title", true);
            xt.send("purl="+uri+"&preq=title");
        }
    }
   
    function aximg()
    {
        var uri    =    document.getElementById('url').value;

        var xi = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
        if (xi)
        {
            xi.onreadystatechange = function()
            {
                if (xi.readyState == 4 && xi.status == 200)
                {
                    document.getElementById('image').value= xi.responseText;
                    document.getElementById('btnS').value="Fill"
                }
            }
            document.getElementById('btnS').value="Filling...";
            xi.open("POST", "getinfo.php?purl="+uri+"&preq=img", true);
            xi.send("purl="+uri+"&preq=img");
        }
    }

    function axlink()
    {
        var uri    =    document.getElementById('url').value;

        var xi = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
        if (xi)
        {
            xi.onreadystatechange = function()
            {
                if (xi.readyState == 4 && xi.status == 200)
                {
                    document.getElementById('infolink').value= xi.responseText;
                    document.getElementById('btnS').value="Fill"
                }
            }
            document.getElementById('btnS').value="Filling...";
            xi.open("POST", "getinfo.php?purl="+uri+"&preq=link", true);
            xi.send("purl="+uri+"&preq=link");
        }
    }
   
    function axdesc()
    {
        var uri    =    document.getElementById('url').value;

        var xd = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
        if (xd)
        {
            xd.onreadystatechange = function()
            {
                if (xd.readyState == 4 && xd.status == 200)
                {
                    document.getElementById('summary').value    = xd.responseText;
                    document.getElementById('btnS').value="Fill"
                }
            }
            document.getElementById('btnS').value="Filling...";
            xd.open("POST", "getinfo.php?purl="+uri+"&preq=desc", true);
            xd.send("purl="+uri+"&preq=desc");
        }
    }

</script>

<form>
<table border="0" cellpadding="1" cellspacing="1">
<tr>
    <td>
    <b>Quick Fill:</b><br /> 
    <input class="url" type='text' size='40' name='url' id='url' value="" /> <input type='button' id="btnS" value='Fill' onclick="ax(this);" /> 
    </td>
</tr>
</table>

            <div><input class="title" type="text" size="40" id="txtTitle" name="name" value="" /></div>

            <div><input class="url" type="text" maxlength="1000" size="40" name="info" id="info" value="" /></div>

            <div><input class="img" type="text" maxlength="1000" size="40" name="image" id="image" value="" /></div>
</form>

PHP File Code:
PHP Code:

<?php

function get_page($url)
{
    
$ch curl_init();
    
curl_setopt($chCURLOPT_FOLLOWLOCATION1);
    
curl_setopt($chCURLOPT_HEADER0);
    
curl_setopt($chCURLOPT_RETURNTRANSFER1);
    
curl_setopt($chCURLOPT_URL$url);
    
$content curl_exec($ch);
    return 
$content;
}

$purl        "";
$preq        "title";
$title    "";
$desc        "";
$imgl        "";

extract($_REQUEST);

if(
$purl!="") {

    
$content get_page($purl);
      
// ###############  GAMESTOP INFO    
 
if(preg_match("~gamestop.com~"$purl))
    {
        
preg_match("~<td width=\"510\" align=\"left\" class=\"prodtitle\" valign=\"top\">.+?(.+?)&nbsp;.+?</td>~s"$content$res);
        
$replacements "/\'/";
        
$titles trim($res[1]);
        
$title strip_tags(preg_replace($replacements,'',$titles));
                
        
preg_match("~<img src=\"(/common/images/lbox[^\"]+)~s"$content$resimg);
        
$img1 strip_tags("http://www.gamestop.com".$resimg[1]."");
        
preg_match("~<td width=\"620\" class=\"stdcopy\">(.+?)</td>~s"$content$resdesc);
        
$replacements "/\'/";
        
$desc strip_tags(preg_replace($replacements,'',$resdesc[1]));
        
$desc trim($desc);
        if (empty(
$desc)) { $desc "No Description Available"; }        
    }


}
 
//$img = cacheFetch($img1,"");

if($preq=="title")
    print(
$title);
else if(
$preq=="desc")
    print(
$desc);
else if(
$preq=="img")
    print(
$img1);    
else if(
$preq=="link")
    print(
$purl);    
?>

--------------- Added [DATE]1264870365[/DATE] at [TIME]1264870365[/TIME] ---------------

* BUMP * can anyone help me with this code please.


All times are GMT. The time now is 01:33 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00994 seconds
  • Memory Usage 1,758KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_html_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (1)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete