473,387 Members | 1,669 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,387 software developers and data experts.

File Context with PHP 4.4.7

Hi, I'm trying to perform an XMLRPC request as seen in the PHP site,
the only problem is, as the PHP version in my server is 4.4.7(i.e. <
5.0), there is no support to contexts, and the page keeps sending me
warnings about file_get_contents only accepting 2 arguments.

So, what's the alternative to perform a pingback?

The code is as follows:

(...)
$request = xmlrpc_encode_request("pingback.ping", array(HTTP_ROOT."/?
post=".$post_id,$uri), array("encoding" ="utf-8"));

$http_info = array(

'method' ="POST",

'header' ="Content-Type: text/xml; charset=utf-8",

'content' =$request,

);

$context = stream_context_create(array('http' =$http_info));

$file = file_get_contents($pingback, false, $context);
(...)

As you see, the method of data sending must be post(the target script
for pingbacking uses POST variables), so a context NULL just don't get
any response from the server.

Anyway, how to use context in PHP < 5.0?
Mar 10 '08 #1
4 1766
Bumping. This one seems hard, eh?
Mar 18 '08 #2
bruno_guedesav wrote:
Hi, I'm trying to perform an XMLRPC request as seen in the PHP site,
the only problem is, as the PHP version in my server is 4.4.7(i.e. <
5.0), there is no support to contexts, and the page keeps sending me
warnings about file_get_contents only accepting 2 arguments.

So, what's the alternative to perform a pingback?

The code is as follows:

(...)
$request = xmlrpc_encode_request("pingback.ping", array(HTTP_ROOT."/?
post=".$post_id,$uri), array("encoding" ="utf-8"));

$http_info = array(

'method' ="POST",

'header' ="Content-Type: text/xml; charset=utf-8",

'content' =$request,

);

$context = stream_context_create(array('http' =$http_info));

$file = file_get_contents($pingback, false, $context);
(...)

As you see, the method of data sending must be post(the target script
for pingbacking uses POST variables), so a context NULL just don't get
any response from the server.

Anyway, how to use context in PHP < 5.0?
The short answer is, you can't.

The longer answer is, your code isn't safe, anyway. The Xmlrpc
extension is still listed as experimental in PHP 5.2.1 and likely to
remain that way for a while. The function is not officially supported
and can change at any time.

My suggestion would be for you to upgrade to PHP 5.x - or, if you're on
a shared host and they won't upgrade, find another host.

Alternatively, you should be able to emulate the xmlrpc functions with
cURL, but I haven't tried it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Mar 18 '08 #3
>
The short answer is, you can't.

The longer answer is, your code isn't safe, anyway. The Xmlrpc
extension is still listed as experimental in PHP 5.2.1 and likely to
remain that way for a while. The function is not officially supported
and can change at any time.

My suggestion would be for you to upgrade to PHP 5.x - or, if you're on
a shared host and they won't upgrade, find another host.

Alternatively, you should be able to emulate the xmlrpc functions with
cURL, but I haven't tried it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Oh, cool...

Unfortunately, the host is already paid so... no, it won't do.

Any hints on where to start trying to make a pingback response with
cURL?
Mar 18 '08 #4
bruno_guedesav wrote:
>The short answer is, you can't.

The longer answer is, your code isn't safe, anyway. The Xmlrpc
extension is still listed as experimental in PHP 5.2.1 and likely to
remain that way for a while. The function is not officially supported
and can change at any time.

My suggestion would be for you to upgrade to PHP 5.x - or, if you're on
a shared host and they won't upgrade, find another host.

Alternatively, you should be able to emulate the xmlrpc functions with
cURL, but I haven't tried it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================

Oh, cool...

Unfortunately, the host is already paid so... no, it won't do.

Any hints on where to start trying to make a pingback response with
cURL?
Start with the cURL doc. It's not too hard once you get used to it -
the biggest part might be building the stream and interpreting the response.

And just because a host is paid for doesn't mean you shouldn't change.
How much have you paid - vs. how much are you going to waste in time
trying to get something else to work? Sometimes it's better to cut your
losses if they won't upgrade.

Also a good reason not to pay too far in advance.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Mar 18 '08 #5

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

Similar topics

0
by: Bill Burwell | last post by:
I am converting a VB6 WebClass application to VB.Net. Used the VB upgrade tool to do the conversion - and it left me a lot of little code things to do. Did those code things and got my app to...
1
by: Bucky Pollard | last post by:
I have a web service that needs to create a batch file and call it (since there are no APIs for the functionality I am looking for). I am using the Process and ProcessStartInfo objects. When I try...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
10
by: JJ | last post by:
How can I get a SiteMapNodeCollection to output as an XML file?
2
by: msxkim | last post by:
My web app writes some binary data to a file at the client site via Response.BinaryWrite. This action is accomplished in response to a button click, with C# code behind as follows: private void...
3
by: shapper | last post by:
Hello, Could someone tell me how to convert a XML file into another XML file using a XSL file with a parameter? I created the code to do it, and it seems ok, but it is not working. Could...
0
by: =?Utf-8?B?QU9UWCBTYW4gQW50b25pbw==?= | last post by:
Hi, I have been using the code (some of it has been removed for simplicity) below to allow authenticated (using ASP.NET membership database) users to get a file from their archive area. It...
7
by: =?Utf-8?B?QU9UWCBTYW4gQW50b25pbw==?= | last post by:
Hi, I have been using the code (some of it has been removed for simplicity) below to allow authenticated (using ASP.NET membership database) users to get a file from their archive area. It...
7
by: Andrew Jocelyn | last post by:
Hi I'm running an ASP.NET web application under IIS. I'm inserting a cache object with a file based CacheDependency. I've noticed that when the file changes the Cache object is not always...
3
by: =?Utf-8?B?Um9nZXIgTWFydGlu?= | last post by:
Note: My apologies for repeating this post from last week, but my nospam alias and profile account were incorrect. I think I have fixed this, so hopefully this post will trigger MS into a response...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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.