Forum Moderators: coopster

Message Too Old, No Replies

Php / MySQL update script sending empty response

         

toastyc12

4:21 am on Feb 23, 2011 (gmt 0)

10+ Year Member



Hello.

A couple months back, I made a quick script in PHP that takes values from a webpage, and inserts them into an SQL database. The script worked for a while, until recently when my web host upgraded to a new server. Now the script always gives me "(52) Empty reply from server" (using curl).

My knowledge on fixing these sorts of things is fairly limited, so I came here looking for any help or suggestions someone might be willing to offer. Thanks!

My script:

error_reporting(E_ALL | E_STRICT);
$max_execution_time = ini_get( 'max_execution_time' );
require("updatesig.php");
mysql_connect("localhost","myusername","mypassword") or die(mysql_error());
mysql_select_db("hlallian_rank") or die(mysql_error());
//After Connection
$result1 = mysql_query("SELECT name, rank FROM group") or die(mysql_error());
while ($row1 = mysql_fetch_array($result1, MYSQL_ASSOC))
{
$char = $row1['name'];
// echo "<br/>updating $char";
$searchStatus = getCharData($char, $charData);
$exppercent = sprintf('<br>%.2F', $charData['expPercent']).'%';
mysql_query("UPDATE group SET class='{$charData['jobImageURL']}', avatar='{$charData['characterImageURL']}', pet='{$charData['petImageURL']}', level='{$charData['level']}', exp='{$charData['experience']}', percent='{$exppercent}', rank='{$charData['rank']}' WHERE name='{$char}'")or die(mysql_error());
set_time_limit( $max_execution_time );
}


Updatesig.php contains the code that fetches the data from the website, using regular expressions and preg_match.

jatar_k

5:37 pm on Feb 23, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld toastyc12,

you would need to look specifically at the curl call since that is what's giving you the error

you could try the url in a browser directly to see if that gives you anything different

I also read a few places to watch for trailing spaces in the url causing this error

toastyc12

6:26 am on Feb 24, 2011 (gmt 0)

10+ Year Member



Thanks for the response. Google Chrome reads the following error message: Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error.

rocknbil

5:12 pm on Feb 24, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, it's highly possible they are on to you and have blocked your script? Go into updatesig.php, point it at another site, see if it works. If it does, they may be blocking curl requests.

If it's working, as jatar_k alludes, has the URL changed, is it being redirected internally? An example might be a CMS that redirects internally for SEO-friendly URL's.