如何使用file_get_contents获取结果数

I have php file named http://example.com/result.php?site=qxvyp6g6vefmt6tduifcr3swhuzo0uju&num=2 which when executed, given only top 2 results. Here num is variable and can be changed to any value n to get top n results. This works fine when called from browser address bar.

Now i use to get this file content by

<?php
echo file_get_contents("http://example.com/result.php?site=" . $_GET["site"] . "&num="2"");
?>

On a page having url ABC.com/index.php?site=qxvyp6g6vefmt6tduifcr3swhuzo0uju

This was working fine before adding &num="2" to file_get_contents. but after adding this gives a mysql error. Kindly help.

You are using "" inside "", so php thinks this is not a string. Replace the "" around the 2 with single ones (like '2') and it should work.

Just change this line

<?php
echo file_get_contents("http://example.com/result.php?site=" . $_GET["site"] . "&num="2"");
?>

like this

<?php
echo file_get_contents("http://example.com/result.php?site=" . $_GET["site"] . "&num=2");
?>