Sinisterly
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


RE: Making a post request using curl and compare the results - privateloader - 07-22-2015

(07-22-2015, 12:44 AM)Crypt Wrote: 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.

The hard part which is adding multiple sites is what i will be focus on. Asking for code is the first step assembly for a purpose is the second one.


RE: Making a post request using curl and compare the results - Dyme - 07-23-2015

(07-22-2015, 01:16 PM)privateloader Wrote: The hard part which is adding multiple sites is what i will be focus on. Asking for code is the first step assembly for a purpose is the second one.

I mean I guess it's hard if you know literally nothing about programming... which seems to be the case for you.

PHP Code:
<?php function send_request($url) { $string = "STRING TO SEARCH FOR"; $ch = curl_init(); $curlConfig = array( CURLOPT_URL => $url, 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); } $handle = fopen($argv[1], "r"); if ($handle) { while (($line = fgets($handle)) !== false) { $url = substr($line, 0, -1); send_request($url); } fclose($handle); } else { echo "File could not be found/read\n"; } ?>

Create a file with your desired URLs on one line each. Then run the script with the filename as the first argument.


RE: Making a post request using curl and compare the results - privateloader - 07-23-2015

Thanks i have all i need for this project...


RE: Making a post request using curl and compare the results - Dyme - 07-23-2015

(07-23-2015, 03:16 PM)privateloader Wrote: Thanks i have all i need for this project...

Yeah so when am I getting paid?


RE: Making a post request using curl and compare the results - Satan - 07-23-2015

(07-23-2015, 03:17 PM)Dyme Wrote: Yeah so when am I getting paid?

Once you get a job you damn hippie.

He doesn't seem like the kind to pay up


RE: Making a post request using curl and compare the results - Dyme - 07-23-2015

(07-23-2015, 03:34 PM)Six Wrote: Once you get a job you damn hippie.

He doesn't seem like the kind to pay up

hey hey hey I actually do have a job watering rich people's plants now so watch how ur talking to me boiiii


RE: Making a post request using curl and compare the results - privateloader - 07-29-2015

(07-23-2015, 03:17 PM)Dyme Wrote: Yeah so when am I getting paid?

How much do you want? It worth $1. Just pm me your paypal email...


RE: Making a post request using curl and compare the results - Jiggly - 07-29-2015

I know this is a really shit post... But I just wanted to say how I wish I understood what wizard language this thread is in O.o


RE: Making a post request using curl and compare the results - Dyme - 07-29-2015

(07-29-2015, 06:56 PM)privateloader Wrote: How much do you want? It worth $1. Just pm me your paypal email...

$2

(07-29-2015, 10:28 PM)Jiggly Wrote: I know this is a really shit post... But I just wanted to say how I wish I understood what wizard language this thread is in O.o

Swahili