Jump to content

bennyEire

New Members
  • Posts

    5
  • Joined

  • Last visited

bennyEire's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. After messing around for like a fill day this code done the trick foreach($jsonObj->d->results as $value){ echo "<a href=\"{$value->Url}\">{$value->Title}</a><p>{$value->Description}</p>". "<br>"; } Thanks for your help
  2. I'll give this a try, the str_rpl is used to normalize the urls, ie. it takes out http://, www. https://
  3. So would the structure be something like this foreach($bingarray as $key => $value) { foreach($value.....){ // I'm not sure what goes in here echo "<href={$bingArray[str_replace ($find, '', ($item->{'Url'}))]}>". $bingArray[$key]['title'] . "</a> <br>" . $bingArray[str_replace ($find, '', ($item->{'url'}))] . "<br>" . $bingArray[$key]['snippet']; echo "<br>"; echo "<br>"; } } what do I put in the second foreach loop
  4. That will print the array out, but the loop I'm trying returns , Undefined variable: key and Undefined index:, I stumped :-(
  5. Hey peps, I'm a bit of a noob a php so please be gentle, The following code is an associated array which takes info form a search engine such as url,title and snippet, $blekkoArray = array(); $find = array ('http://','https://','www.'); $score = 100; foreach ($js->RESULT as $item) { $blekkoArray[str_replace ($find, '', ($item->{'url'}))] = array( 'title'=> $item->{'url_title'}, 'snippet' => $item->{'snippet'}, 'score' => $score-- ); } when I do a print_r this is the output I get Array ( [example.com] => Array ( [title] => Example title [snippet] => Blah Blah Blah [score] => 100 ) [example2.com] => Array ( [title] => Example title2 [snippet] => Blah Blah Blah2 [score] => 99) [example3.com] => Array ( [title] => Example title3 [snippet] => Blah Blah Blah3 [score] => 98 ) .......) I'm trying to get an output like the following below example.com // I would like this to be a href clickable link Example title Blah Blah Blah example.com 2 Example title Blah Blah Blah 2 and so on, this is the code I've tried foreach ($js->RESULT as $item) { echo "<href={$blekkoArray[str_replace ($find, '', ($item->{'url'}))]}>". $blekkpArray[$key]['title'] . "</a> <br>" . $blekkoArray[str_replace ($find, '', ($item->{'url'}))] . "<br>" . $blekkoArray[$key]['snippet']; echo "<br>"; echo "<br>"; } but when I run the code I'm getting undifined index and undifined variable warnings, can anyone help please
×
×
  • 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.