Jump to content

PHP modul problem, please help (images module for meta search engine)


rozbif

Recommended Posts

I have problem with PHP module for meta search engine, this module takes image results from google and sends it to meta search engine as a result. But it is not working, there is a problem in PHP code witch i have no idea how to find and fix.

<?php


class image_google {

    function image_google() {
        $this->profile = array(
            'site_name' => 'Google',
            'site_url' => 'http://www.google.com',
            'request_url' => 'http://www.google.com/search?q=$e_qry_str&site=images&tab=wi&start='.(20*($_REQUEST['d']-1)),
        );
    }

    function parse_results(&$output) {
        #echo $output;  # debug
        $results = array();
        if(preg_match_all('{imgurl=(.*?)&imgrefurl=(.*?)&}is',html_compress(remove_code($output)),$matches,PREG_SET_ORDER)) {
            $last_match = '';
            foreach($matches as $r) {
                $result = array(
                    'real_url' => html_decode($r[2]),
                                                 'follow_url' => html_decode($r[1]),
                    'image_url' => html_decode($r[1]),
                    'title' => html_decode($r[1]),
                    'description' => html_decode($r[1]),
                );
                array_push($results,$result);
                $last_match = &$r[0];
            }
            if($last_match) {
                $offset = strpos($output,$last_match)+strlen($last_match);
                $output = substr($output,$offset);
            }
        }
        #var_export($results); # debug
        return $results;
    }

}

?>

Link to comment
Share on other sites

How exactly is it "not working". Not working can mean 1 of many many things, and without more information, its hard to pinpoint a problem. Is there an error? Is nothing happening? is something happening but not what you expect?

 

Basically, we need to know what is happening, what you want to happen, and any other information (like if there is an error or something)

Link to comment
Share on other sites

This happens http://googleov.com/search?qry_str=images&category=images

when somebody trays to do an image search

but if i add this code    if(preg_match_all('{imgurl=(.*?)&imgrefurl=(.* ?)&}is'      it shows 2 images and a lot of links below them

But it needs to show 20 images per page, without all of those huge links. only 20 images and title ....

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.