Jump to content

Check page for value


EchoFool

Recommended Posts

Hey,

 

I have a row of codes which i want to check on an external page exists in some kind of loop using CURL.

 

How ever the only way to obtain the codes on the external website is to be on index.php with POST name "showtype" set to 1. Otherwise they will not load the list.

 

Can some one explain how i load up such a page with a set POST on my site with CURL to check if the code exists based on the value from my array??

 

Hope you can help.

Link to comment
https://forums.phpfreaks.com/topic/193860-check-page-for-value/
Share on other sites

This is what i tried but i don't know what half of it does.

 

<?php

$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookieFileName");   // no idea what this is
curl_setopt($ch, CURLOPT_URL,"http://www.mydomain.com/?c=login");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "username=user1&password=test12&login=1&redir=1");


ob_start();      // prevent any output
curl_exec ($ch); // execute the curl command
ob_end_clean();  // stop preventing output

curl_close ($ch);
unset($ch);

$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // no idea what this is
curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/cookieFileName"); // no idea what this is


curl_setopt($ch, CURLOPT_URL,"http://www.domain.com/subfolder/index.php"); //here i need to send a secondary POST to get the list which i mentioned in my original first post! 

$buf2 = curl_exec ($ch);

curl_close ($ch);

echo "<PRE>".htmlentities($buf2);
?>

curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookieFileName");  // no idea what this is

The name and location of the cookie sent by the site so curl can use it.

 

curl_setopt($ch, CURLOPT_URL,"http://www.domain.com/subfolder/index.php");

//here i need to send a secondary POST to get the list which i mentioned in my original first post!

 

Here is where you have to use the parts from the post example.

 

For any OPTS you dont understand do a bit of rtm'ing.

 

 

HTH

Teamatomic

 

No, not at all. I have no idea what browser you use or what version it is. You however do, or at least should. So in the time it takes you to post the question you could google and have the answer.

 

Then after that you may have a relevant question like:

I use the latest firefox and it uses sqllite to store cookie...what do I do now??

 

 

HTH

Teamatomic

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.