Jump to content

Recommended Posts

Welcome

I would like to create a link URL or script that will be assigned to a button on my website, but when pressed will open the outside website and pressed button on this site.

 

This button on the outside website is not assigned to link button is assigned to function and this is a problem for me.

I made a url link that is writing on the outside website text "username" in form


 

I want to do something like this but instead of typing I want to press the button

using the url link or script.

 

 

This is a sample page and button code

Page:


Button code:

<button class="btn btn_light" id="btn_wlist" onclick="sendAction('6')"><span><em class="i_subscribe"> </em>Add TV Show to Watchlist</span></button>

Is it possible to click the button using the id or something.

 

Please help
Link to comment
https://forums.phpfreaks.com/topic/278113-go-to-and-click-button/
Share on other sites

My question is how to get the html code of for example www.example.com and then read the value of one line using the id.
<input type="hidden" name="elementId" value="7548" id="elementId">

So I want to get the html code of website to a variable and then I want to read the value of a single line in the whole code using the id in this case I want numer (7548) and then insert this numer to the variable and then i want connect link with variable
www.example.com/z
where {z} is a variable in this case numer 7548 then I want create variable using this to parts www.example.com/ and z

I want the whole code to be activated when I press button.
Please help

Edited by Jacq

My question is how to get the html code of for example www.example.com and then read the value of one line using the id.

<input type="hidden" name="elementId" value="7548" id="elementId">

 

So I want to get the html code of website to a variable and then I want to read the value of a single line in the whole code using the id in this case I want numer (7548) and then insert this numer to the variable and then i want connect link with variable

www.example.com/z

where {z} is a variable in this case numer 7548 then I want create variable using this to parts www.example.com/ and z

I want the whole code to be activated when I press button.

Please help

 

Are you trying to parse an html from other live site?

If so, try using DOMDocument and DOMXPath to parse html and get the element that you want

<?php

// Hide errors
$oldSetting = libxml_use_internal_errors( true );
libxml_clear_errors();

// Instantiate domdocument so we can fetch the html
$dom = new DOMDocument();
$dom->loadHTMLFile('http://forums.phpfreaks.com/');	// put your website to scrape here

// Instantiate domxpath to perform query so we can search an html element by their ids/classname.
$xpath = new DOMXPath($dom);

// This query will find all the <input type="hidden">
// use "//input[@id='elementid']" if you want to search by their id
$entries = $xpath->query("//input[@type='hidden']"); 

// Loop through each result then get the "value" attribute
foreach ($entries as $entry)
{
	echo $entry->getAttribute('value') . '<br>';
}

libxml_clear_errors();
libxml_use_internal_errors( $oldSetting );
  • 1 month later...

How to add this numer result to a link.

 

So I want to get the html code of website to a variable and then I want to read the value of a single line in the whole code using the id in this case I want numer (7548) and then insert this numer to the variable and then i want connect link with variable
www.example.com/z
where {z} is a variable in this case numer 7548 then I want create variable using this to parts www.example.com/ and z

I want the whole code to be activated when I press button.
Please help

Help me with this code:

 

<?php
// Hide errors
$oldSetting = libxml_use_internal_errors( true );
libxml_clear_errors();
 
// Instantiate domdocument so we can fetch the html
$dom = new DOMDocument();
$dom->loadHTMLFile('http://www.btvguide.com/Keeping-Up-with-the-Kardashians');    // put your website to scrape here
 
// Instantiate domxpath to perform query so we can search an html element by their ids/classname.
$xpath = new DOMXPath($dom);
 
// This query will find all the <input type="hidden">
// use "//input[@id=elementid]" if you want to search by their id
$entries = $xpath->query("//input[@id=elementid]"); 
 
// Loop through each result then get the "value" attribute
foreach ($entries as $entry)
{
    echo $entry->getAttribute('value') . '<br>';
}
 
libxml_clear_errors();
libxml_use_internal_errors( $oldSetting );
echo $entry;
?>

 

 

This code doesn't work.

Guest
This topic is now 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.