Note that there are some explanatory texts on larger screens.

plurals
  1. POfile_get_contents and variables
    primarykey
    data
    text
    <p>I have a text file filled with a list of IDs. Using PHP, I am trying to load a url for each of the IDs and pull something from that page (another id)</p> <p>For example, if I have the IDs 555, 888, 222 I want to load the URLs </p> <p><a href="http://example.edu/bvl.P_Sel?facultyID=555" rel="nofollow noreferrer">http://example.edu/bvl.P_Sel?facultyID=555</a> </p> <p><a href="http://example.edu/bvl.P_Sel?facultyID=888" rel="nofollow noreferrer">http://example.edu/bvl.P_Sel?facultyID=888</a></p> <p><a href="http://example.edu/bvl.P_Sel?facultyID=222" rel="nofollow noreferrer">http://example.edu/bvl.P_Sel?facultyID=222</a></p> <p>I tried to get the content via<br> <code>file_get_contents("http://example.edu/bvl.P_Sel?facultyID=$lines[0]");</code></p> <p>where $lines is an array of the IDs. This returns the following error:</p> <pre><code>Warning: file_get_contents(http://example.edu/bvl.P_Sel?facultyID=222) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 </code></pre> <p>That url is an example, but the url in the error does work when I visit it manually. And if I replace the file_get_contents variable with an actual ID, like <code>?facultyID=222</code>, it works perfectly.</p> <p>I visited this question's answer <a href="https://stackoverflow.com/questions/2445276/how-to-post-data-in-php-using-file-get-contents/2445332#2445332">How to post data in PHP using file_get_contents?</a> and tried assigning a variable in the $postdata array to a variable, and I get the same exact error only with <code>?facultyID=XXX</code> removed from the error message's url.</p> <p>My implementation of the latter is <a href="http://pastebin.com/yykLAePs" rel="nofollow noreferrer">here</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload