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
https://forums.phpfreaks.com/topic/209612-curl-doesnt-want-to-play-ball/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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