5 Replies - 461 Views - Last Post: 25 February 2013 - 06:59 PM Rate Topic: -----

#1 JohnFYI  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 19-November 12

Unknown error? T_RETURN?

Posted 25 February 2013 - 05:21 PM

Well, I keep getting this error. I've never had it and I have no clue why.

PHP Parse error: syntax error, unexpected T_RETURN in /root/script.php on line 60

http://gyazo.com/627....png?1361837652

	function get_google($kw, $res=10, $geo='US') {
		$urls = array();
		if ($geo == '') $geo = 'US';
		$url  = 'http://www.google.com/search?hl=en&as_qdr=all&gl='.$geo.'&q='.urlencode($kw).'&num='.$res;
		try {
			$html = curl_fetch($url);
		
			$dom = new DOMDocument();
			@$dom->loadHTML($html);
			$xpath = new DOMXPath($dom);
			$hrefs = $xpath->evaluate("/html/body//a");
			for ($i = 0; $i < $hrefs->length; $i++) {
				$href = $hrefs->item($i);
				if ($href->getAttribute('class') == 'l') {
					$link = explode('?', $href->getAttribute('href'));
					$urls[] = $link[0];
				}
			}
		} catch (Exception $e) {}
		return $urls;
	}


Would like some help if someone could! Thanks!

Is This A Good Question/Topic? 0
  • +

Replies To: Unknown error? T_RETURN?

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3569
  • View blog
  • Posts: 10,402
  • Joined: 08-June 10

Re: Unknown error? T_RETURN?

Posted 25 February 2013 - 05:25 PM

donít see anything wrong there (syntax-wise).
Was This Post Helpful? 0
  • +
  • -

#3 JohnFYI  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 19-November 12

Re: Unknown error? T_RETURN?

Posted 25 February 2013 - 05:32 PM

View PostDormilich, on 25 February 2013 - 05:25 PM, said:

donít see anything wrong there (syntax-wise).

I don't, i'm so stuck now :S.
Was This Post Helpful? 0
  • +
  • -

#4 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3569
  • View blog
  • Posts: 10,402
  • Joined: 08-June 10

Re: Unknown error? T_RETURN?

Posted 25 February 2013 - 05:38 PM

though it would make more sense to use parse_url() than explode().
Was This Post Helpful? 0
  • +
  • -

#5 e_i_pi  Icon User is offline

  • = -1
  • member icon

Reputation: 800
  • View blog
  • Posts: 1,686
  • Joined: 30-January 09

Re: Unknown error? T_RETURN?

Posted 25 February 2013 - 06:57 PM

Where is line 60?
Was This Post Helpful? 0
  • +
  • -

#6 JohnFYI  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 19-November 12

Re: Unknown error? T_RETURN?

Posted 25 February 2013 - 06:59 PM

View Poste_i_pi, on 25 February 2013 - 06:57 PM, said:

Where is line 60?


Like 60 is where it goes

try {
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1