473,386 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Posting to another URL

Any help from the gods is appreciated.

I can cut and paste the following into my browser URL address and have
the script execute no problem:

http://subdomain.domain.com/log?amou...orderid=123456

the domain is another site. How can I run a php script on my server
that will essentially post the above, but within my php script?

As always, help from the gods is appreciated.

DJ

Jul 17 '05 #1
5 5242
look up documentation on curl. I'm not quite sure what yo u are trying
to do, but here is a sample that sends data to a payment gateway and
awaits a response:
note: not all servers support curl.

// your data - separated with &
$fields = "amount=10.00&orderid=123456";
$url = "https://domain.com/where_you_want_to_post.asp";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
$response = curl_exec($ch);
curl_close ($ch);
// after you post your data, the server response will be stored in the
$response variable

Jul 17 '05 #2
ggg
If you don't have CURL installed on your server, you can make a socket
call with the POST method:

http://www.php-faq.com/postToHost.html

// postToHost.php
// Sample of posting to a local or remote server
// Written by Rasmus Lerdorf
// buy his book published Mar 2002
// ---------------------------------------------
//Use fsockopen to send the data:
$host = "your.host";
$port = 80;
$postdata = "field1=value1&field2=value2&field3=value3";
if ($sp = fsockopen($host, $port)) {
fputs($sp,"POST /path/to/script.php HTTP/1.0\n");
fputs($sp,"Host: $host\n");
fputs($sp,"Content-type: application/x-www-form-urlencoded\n");
fputs($sp,"Content-length: ".strlen($postdata)."\n");
fputs($sp,"Connection: close\n\n");
fputs($sp,$postdata);
fclose($sp);
}

In article <11**********************@f14g2000cwb.googlegroups .com>,
dj*****@citgo.com says...
Any help from the gods is appreciated.

I can cut and paste the following into my browser URL address and have
the script execute no problem:

http://subdomain.domain.com/log?amou...orderid=123456

the domain is another site. How can I run a php script on my server
that will essentially post the above, but within my php script?

As always, help from the gods is appreciated.

DJ

Jul 17 '05 #3
<dj*****@citgo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Any help from the gods is appreciated.

I can cut and paste the following into my browser URL address and have
the script execute no problem:

http://subdomain.domain.com/log?amou...orderid=123456

the domain is another site. How can I run a php script on my server
that will essentially post the above, but within my php script?

As always, help from the gods is appreciated.


I don't know why people keep suggesting CURL or socket when there is a
standard way to do a post in PHP: a stream context.

See this thread:

http://groups-beta.google.com/group/...9b5eb9e7a6275e
Jul 17 '05 #4
I noticed that Message-ID:
<11**********************@f14g2000cwb.googlegroups .com> from
dj*****@citgo.com contained the following:
As always, help from the gods is appreciated.


Saints, not gods. :-)

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #5
ggg

I don't know why people keep suggesting CURL or socket when there is a
standard way to do a post in PHP: a stream context.

See this thread:

http://groups-beta.google.com/group/...9b5eb9e7a6275e


I know why. It's because streams is a post 4.3 feature -- I didn't know
about it. I ought to keep up with things.
Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jonathan M. Rose | last post by:
I am looking for a script that I can sit on an HTML server (Linux, Apache, PHP/Perl/Python/Etc.) that will allow me to do the following things: 1) Post news articles that consists of (i) a title...
23
by: Jeff Rodriguez | last post by:
Here's what I want do: Have a main daemon which starts up several threads in a Boss-Queue structure. From those threads, I want them all to sit and watch a queue. Once an entry goes into the...
2
by: Stu | last post by:
Hi, When I try and use Javascript to post page form data from one aspx page to another I get the error 'Unable to validate data. '. I am not trying to read the data using web controls I am...
62
by: Jeff Brown | last post by:
I hear people say not to multipost, does these mean not to ask the same question in another group or to submit the question to all the groups via the same submission, with multiple newsgroups in...
2
by: Esa | last post by:
Hi, I'm having problems with one strange web system where submitting an application and making queries about its handling status require a series of form submits and response parsing - all in...
31
by: damacy | last post by:
hi, there. i have a problem writing a program which can obtain ip addresses of machines running in the same local network. say, there are 4 machines present in the network; , , and and if i...
4
by: Peter Afonin | last post by:
Hello, I have a form with several buttons, and I need to post this data to several different applications. In ASP.NET 1.1 it was quite easy - I just used HTML controls (text or hidden), then...
44
by: Bruce Wood | last post by:
This subject has come up several times in this group over the last year. Several people in this group seem to feel strongly about this topic. Rather than derail other threads with this discussion,...
4
by: Boki | last post by:
Hi All, I need to let user type some text in a textbox, and user will click a button to submit the material. It is very straightforward if we implement it by single thread. But the...
27
by: Alan T | last post by:
I am not sure which way to go: Want to learn C# but C# is implemented both in Windows desktop application and ASP.NET. I am not familiar with web programming, should I start with Windows app or...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.