![]() |
|
Making a post request using curl and compare the results - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: PHP (https://sinister.li/Forum-PHP) +--- Thread: Making a post request using curl and compare the results (/Thread-Making-a-post-request-using-curl-and-compare-the-results) Pages:
1
2
|
Making a post request using curl and compare the results - privateloader - 07-19-2015 Please i need help on this one, i want to make an http post using php curl function and cache that page. After that i want to search for the presence of a specific line. I know that buffering the page is not reliable but i want to give a try. I know that this works, i had this piece of code working a few years back i eventually lost it. Thanks in Advance RE: Making a post request using curl and compare the results - w00t - 07-19-2015 Do you actually mean you want to cache it, or do you just need it in a variable so you can parse it? RE: Making a post request using curl and compare the results - Oni - 07-19-2015 I remember I wrote a script that did something similar when I discovered this vulnerability: https://sinister.li/Thread-Tutorial-vBulletin-Vulnerability-Versions-4-1-to-5 Unfortunately, I no longer have it. I'm sure @Reiko or @roger_smith might know. RE: Making a post request using curl and compare the results - Reiko - 07-20-2015 returntransfer? RE: Making a post request using curl and compare the results - Crypt - 07-20-2015 http://www.hackingwithphp.com/15/10/3/the-abridged-list-of-curl-options RE: Making a post request using curl and compare the results - Reiko - 07-20-2015 (07-20-2015, 01:32 PM)Crypt Wrote: http://www.hackingwithphp.com/15/10/3/the-abridged-list-of-curl-options CURLOPT_RETURNTRANSFER RE: Making a post request using curl and compare the results - privateloader - 07-20-2015 Using curl.exe won't work i think as i want to make a post request and search for a text string, after the post, if the text string exists then echo "Yes it is present" if not echo "No it isn't present". It will be very good if it was possible in batch, any sugestions? RE: Making a post request using curl and compare the results - Dyme - 07-20-2015 Since no one will do it for you: PHP Code: <?php
$string = "STRING TO SEARCH FOR";
$ch = curl_init();
$curlConfig = array(
CURLOPT_URL => "URL TO SEND POST REQUEST TO",
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => array(
'field1' => 'some data',
'field2' => 'some other data',
)
);
curl_setopt_array($ch, $curlConfig);
$result = curl_exec($ch);
if (strpos($result, $string) !== false) {
echo "true\n";
}
else
{
echo "false\n";
}
curl_close($ch);
?>I'm pretty sure that's what you are looking for. It will print true if the string is found in the post request response, and print false otherwise. Shout out Stackoverflow. RE: Making a post request using curl and compare the results - privateloader - 07-22-2015 Thanks, i got the code working ![]() Step 2: How do i add a form where the string becomes a user input and add multiple sites. (This is my first project in this language) RE: Making a post request using curl and compare the results - Crypt - 07-22-2015 (07-22-2015, 12:39 AM)privateloader Wrote: Thanks, i got the code working Why are you calling it "your" first project when all you're doing is getting spoonfed code? You can make the string come from user input by doing one of these two: $argv[1] if you're executing it inside a terminal. $_REQUEST['anything'] if you're accessing it on a web interface. If this is your project, you should be figuring these things out, not having others do it for you. You should do the multiple sites part on your own. |