Jump to content

Find string in website/webpage


greg duke

Recommended Posts

Hi All,

 

I'm new at php and I need your help.

 

I'm trying to find a string in a website. I want my website to get a string on another website(I have full access) without really opening it on a browser. For example the string is "MyID=123456", i want to find "MyID=123456"(the MyID number is random and always changing but always 6 random numbers) on another website and output only "123456" on my website. Is this possible?

 

Please help. Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/229578-find-string-in-websitewebpage/
Share on other sites

Try this out

 

$page = file_get_contents('http://www.example.com/');
$sub = stristr($page, "myid=");
$num = sub_str($sub, 0, 6);  // assuming the value will always be six characters

 

If you need to find the id for any variable length you'll have to split on the space after the value, but I'm sure you can figure the rest out.

Try this out

 

$page = file_get_contents('http://www.example.com/');
$sub = stristr($page, "myid=");
$num = sub_str($sub, 0, 6);  // assuming the value will always be six characters

 

If you need to find the id for any variable length you'll have to split on the space after the value, but I'm sure you can figure the rest out.

 

Thank you it worked.

Thanks you for your help.

 

One more thing, I can find any sting to a website expect if it is inside an frame, but in a browser when I right click the frame and view page source I can see the string I want to find. This is the link http://apps.facebook.com/cityville/invite.php. Please help if my problem can be resolved. Thanks!

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.