The right code

4 posts by 2 authors in: Forums > CMS Builder
Last Post: October 9, 2008   (RSS)

By Kenny - October 9, 2008 - edited: October 9, 2008

I am missing something here - can someone tell me what I am doing wrong? This script is designed to tell you how many pages Google has indexed for your site. Works great when you hard code a domain name in the script, but when I try to add an echo statement from CMS Builder, I get errors.

<?php
error_reporting (E_ALL ^ E_NOTICE);

include 'functions.php';

// Site to check
$site = 'www.echo $webpanelRecord['domain']';

// Connect to this url using CURL
$url = 'http://www.google.ro/search?hl=en&q=site%3A'.$site.'&btnG=Search';

$data = LoadCURLPage($url);

// Extract information between STRING 1 & STRING 2

$string_one = '</b> of about <b>';
$string_two = '</b>';

$info = extract_unit($data, $string_one, $string_two);

echo 'Google has indexed '.$info.' pages for '.$site.'.';
?>



I have tried to put the original statement in there and it didn't work and it doesn't work when I cut it down to echo $webpanelRecord['domain']'


My top of page code is all right for a page viewer - I have other elements that show up fine.

Re: [sagentic] The right code

By Dave - October 9, 2008

Hi Kenny,

Try this:

$site = 'www' . $webpanelRecord['domain']';

Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [sagentic] The right code

By Dave - October 9, 2008

Looks like I missed that trailing single quote before the semi-colon. Change this:

$site = 'www' . $webpanelRecord['domain']';

to this:

$site = 'www' . $webpanelRecord['domain'];

Let me know if you get any more errors with that.
Dave Edis - Senior Developer
interactivetools.com