Jump to content

[HELP] File_Get_Contents


BRUm

Recommended Posts

Hi,

I need to file_get_contents of multiple website dynamically, so I use arrays in a loop to connect to. Here's a snippet:

[code=php:0]
      for ($i = 1; $i < sizeof($linkarray[0])-3; $i++){
 
          echo ("<a href=" . $linkarray[1][$i] . "> <font color='red'><b>" . $linkarray[2][$i] . "</b></a></font><br><br> ");
 
          $ccontent = file_get_contents($linkarray[1][$i]);
 
      $rele = preg_match("/".$pieces[0].".*/", $ccontent, $rel);
 
      ECHO $rel[0]."<BR><BR>";

      }
[/code]


So it loops, and gets the contents of some sites, yet when I echo the output array $rel[0]; I get Failed to stream for each one, despite them being valid URLs.

If someone could help it would be great ,

Thanks,

Lee.
Link to comment
Share on other sites

It's not a complicated array, just the basic:

[/code]
[1] => Array
        (
            [0] => "http://froogle.google.co.uk/froogle?=en&q=cars&btnG=Google+Search&sa=N&tab=wf"
            [1] => "/movies/reviews?cid=b3d997eccb5717fb&fq=cars&sa=X&oi=showtimes&ct=reviews&cd=2"
            [2] => "http://www.channel4.com/4car/"
            [3] => "http://www.cars.com/"
            [4] => "http://www.autotrader.co.uk/"
            [5] => "http://uk.cars.yahoo.com/"
            [6] => "http://www.imdb.com/title/tt0317219/"
            [7] => "http://www.carsthemovie.com/"
)
[/code]

This is only the $linkarray[1][$i] part. $linkarray[0] and [2] contain other stuff.
Link to comment
Share on other sites

First couple of elements look as though they should be all 1 element
[code]<?php
$linkarray = array (
        1 => array( 

        "http://froogle.google.co.uk/froogle?=en&q=cars&btnG=Google+Search&sa=N&tab=wf/movies/reviews?cid=b3d997eccb5717fb&fq=cars&sa=X&oi=showtimes&ct=reviews&cd=2",
        "http://www.channel4.com/4car/",
        "http://www.cars.com/",
        "http://www.autotrader.co.uk/",
        "http://uk.cars.yahoo.com/",
        "http://www.imdb.com/title/tt0317219/",
        "http://www.carsthemovie.com/",
        )
);

$ccontent = file_get_contents($linkarray[1][0]);
echo $ccontent;
?>[/code]
Link to comment
Share on other sites

Ah right, yes I understand. Still, I get:

[code]Warning: file_get_contents("http://www.carsthemovie.com/"): failed to open stream: No such file or directory in /home/hydropow/public_html/izearch/searched.php on line 161[/code]
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.