Jump to content

benphp

Members
  • Content Count

    336
  • Joined

  • Last visited

Community Reputation

0 Neutral

About benphp

  • Rank
    Advanced Member

Profile Information

  • Gender
    Not Telling
  1. CURL is a dll on my Windows server - I don't know how to run that from CMD - unless I download the standalone curl.exe. If I wait half an hour or so I finally get an error from fie_get_contents: Warning: file_get_contents(http://www.google.com) [ function.file-get-contents]: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. My intuition is that there's some server or network setting that is denying the HTTP request from the server.
  2. I can use both file_get_contents and CURL to fetch the contents of a file on my server, but when I attempt to read a file from outside the server, both just spin forever, never reading the file. I'm on IIS7 - and Curl is installed and running. I can browse to the locations with no trouble, but if I attempt to fetch the files using PHP, I get nothing. Is there some other setting in IIS that I need to enable or disable? What am I missing? Neither works: $sourceLink = "http://www.google.com"; $sourcePageHTML = file_get_contents($sourceLink); print $sourcePageHTML; $ch = curl_init("http://www.google.com"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $data = curl_exec($ch); print($data); Both work: $sourceLink = "http://myserver/myfile.php"; $sourcePageHTML = file_get_contents($sourceLink); print $sourcePageHTML; $ch = curl_init("http://myserver/myfile.php"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $data = curl_exec($ch); print($data);
  3. OK -thanks! Yes, that works. But what if I did this: SELECT Courses.CourseTitle, Events.EventDate FROM Courses LEFT JOIN Events on (Events.CID = Courses.CID) Distinct wouldn't work, right?
  4. I want to fetch the titles from the Courses table, but I only want the Course Title to return once when I join Events. Courses CID | CourseTitle 1 | Course A 2 | Course B 3 | Course C Events EID | CID | EventDate 1 | 1 | 2016-02-22 2 | 1 | 2016-02-23 3 | 2 | 2016-02-24 4 | 3 | 2016-02-25 5 | 3 | 2016-02-26 If I use a JOIN, SELECT Courses.CourseTitle FROM Courses LEFT JOIN Events on (Events.CID = Courses.CID) then I get Course A Course A Course B Course C Course C But what I want is Course A Course B Course C Because ultimately, I'm going to select an Event date range, and I want to see just the courses with the event date range. Thanks!
  5. I found the trouble. I'm using Notepad++, and I replaced all carriage returns with new line (replaced \r with \n). I'm not sure how the \r got in there.
  6. This is new. For some reason, the PHP errors are not counting my //commented lines. Example: <?php //my comment : ?> Parse error: syntax error, unexpected ':' in D:\www\myscript.php on line 2 The error is on line 3. If I add more comments, the error is the same: <?php //my comment //my comment //my comment //my comment //my comment : ?> Parse error: syntax error, unexpected ':' in D:\www\myscript.php on line 2 Where is this setting? Thanks.
×
×
  • 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.