Jump to content

cURL - doesn't want to play ball


Yesideez

Recommended Posts

Here's my script:

<?php
$ch=curl_init('http://www.pictureinthesky.net/bltest/method1.php');
curl_setopt($ch,CURLOPT_COOKIEJAR,'cookie.txt');
curl_setopt($ch,CURLOPT_COOKIEFILE,'cookie.txt');
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_HEADER,false);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true);
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch,CURLOPT_POSTFIELDS,'crime=1&vercode=ABC');
$page=curl_exec($ch);
if (curl_errno($ch)) {
  echo 'ERROR';
}
curl_close($ch);
echo $page;
?>

 

I'm trying to get that to call the URL in the script to check the anti XSS code in my other script is working but all it does is read the page in without submitting the form -I should get an error message!

 

I've checked and the cookie.txt file is being created and contains:

# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This file was generated by libcurl! Edit at your own risk.

www.pictureinthesky.net	FALSE	/	FALSE	0	PHPSESSID	7268ef0b4b6adae605156ac177bdd43e

 

EDIT: The above script can be tried: http://www.pictureinthesky.net/curl/readpage.php

 

I think it might be failing because cURL hasn't been told the name of the submit button and in my code I'm checking for it by name.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.