1

This is my code

Using the example I have above it is outputting that the file "index.php" does not exist on the url website when infact it does exist, it seems to me that curl is trying to open up that file on its own site where the file does not exist. I hope that makes sense. This is what the system writes to my url.txt file when it tries to visit the site

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>
3
  • And do you have some errors? Commented Apr 10, 2014 at 18:09
  • Have you checked the $url1 is in the correct format? Are you sure your ip has not been blocked or reached an access limit? Maybe the servers needs headers? Commented Apr 10, 2014 at 18:10
  • @Silver89 please check question for an update on what the system writes to my url.txt file, and go from there? and yes the format for $url1 in this case is http://highestpaygpt.com/tools/pts/61_4f363ad4359302e.php?sid=ccarson030308_cc8e4499&earned=20&status=1 it seems like the script is trying to open /tools/pts/61_4f363ad4359302e.php on itself Commented Apr 10, 2014 at 18:15

3 Answers 3

4
+50

I've just tested this with Google and this is the output of url.txt (whitespace and all):

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.

</BODY></HTML>


url = http://google.com/

I tested it with the URL you provided and it seems the response gives us a 302:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="http://redirect.main-hosting.com/error404.php/24?domain=earnigc.com">here</a>.</p>
</body></html>

url = http://earnigc.com/index.php?sid=1

Therefore I'd have a look at the server side code (whatever loop/function is checking the value of $_GET['sid']) and see what's going wrong there. If you're constantly getting errors, your IP address may be blocked.

Just to be clear - cURL is working as expected, it's a server side issue.

Edit

With the further information you supplied (URL is actually http://highestpaygpt.com/tools/pts/61_4f363ad4359302e.php?sid=ccarson030308_cc8‌e4499&earned=20&status=1) the response I got was as follows:

You do not have authorization to access this page.
url = http://highestpaygpt.com/tools/pts/61_4f363ad4359302e.php?sid=ccarson030308_cc8‌e4499&earned=20&status=1

Therefore cURL is working exactly as intended, it's your authorisation that is not. Look into using cookies with cURL and/or the authentication methods on the server.

Hang on a sec...

It seems like you're writing an automated cURL script to enter competitions fraudulently (and against that website's terms and conditions).

Sign up to request clarification or add additional context in comments.

9 Comments

That url was reference the actual url that it is trying to hit is http://highestpaygpt.com/tools/pts/61_4f363ad4359302e.php?sid=ccarson030308_cc8‌​e4499&earned=20&status=1 the url is formatted right so I am not too sure what is going on
Wait... are you writing a cURL bot to defraud a website?
No i am writing a script for that site owner, and yes the ip would be blocked it you visit it because only that servers IP is allowed to hit the script successfully -_-
That's fair enough. Well can't tell you much more I'm afraid as cURL is working exactly as intended. Of course, that isn't what you wanted to hear but I think it's time to rip your server apart and have a good investigation there.
What happens when you run that server side? What's the output / error now?
|
3

Firstly, just to make sure, try adding

 curl_setopt($ch, CURLOPT_FOLLOWLOCATION,true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
$verbose = fopen('php://temp', 'rw+');
curl_setopt($ch, CURLOPT_STDERR, $verbose);

Now, after your curl exec, do the following and come back with the result.

rewind($verbose);
$vblog = stream_get_contents($verbose);

echo "<pre>", htmlspecialchars($vblog), "</pre>\n";

6 Comments

All this does is break my script, once it tries to begin the curl function it just stops.
I don't get any it does not display anything
Could you please try to add this error_reporting(E_ALL); ini_set('display_errors', '1'); to the top of your .php file, and see if any errors will show now?
* About to connect() to highestpaygpt.com port 80 (#0) * Trying 162.248.50.132... * connected * Connected to highestpaygpt.com (162.248.50.132) port 80 (#0) &gt; GET /tools/pts/61_4f363ad4359302e.php?sid=ccarson030308_cc8e4499&amp;earned=50&amp;campid=3456 HTTP/1.1 Host: highestpaygpt.com Accept: */* &lt; HTTP/1.1 404 Not Found &lt; Date: Thu, 10 Apr 2014 18:46:26 GMT &lt; Server: Apache &lt; Content-Length: 349 &lt; Content-Type: text/html; charset=iso-8859-1 &lt; * Connection #0 to host highestpaygpt.com left intact
The page does simply not exist. Bad luck :/ If my answer helped you, please feel free to upvote.
|
0

Try this instead with following basic and check any error you got by curl_error & curl_exec() returns true or not:

        // create a new cURL resource
        $ch = curl_init();

        // set URL and other appropriate options
        curl_setopt($ch, CURLOPT_URL, "http://www.example.com/");
        curl_setopt($ch, CURLOPT_HEADER, 0);

        // grab URL and pass it to the browser
        curl_exec($ch);
        if(curl_exec($ch) === false)
        {
            echo 'Curl error: ' . curl_error($ch);
        }
        else
        {
            echo 'Operation completed without any errors';
        }
        // close cURL resource, and free up system resources
        curl_close($ch);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.